/*
 Navicat Premium Data Transfer

 Source Server         : postgres
 Source Server Type    : PostgreSQL
 Source Server Version : 140001
 Source Host           : 127.0.0.1:5432
 Source Catalog        : mes
 Source Schema         : public

 Target Server Type    : PostgreSQL
 Target Server Version : 140001
 File Encoding         : 65001

 Date: 09/01/2022 10:06:25
*/


-- ----------------------------
-- Sequence structure for bomstylematerialdetail_iid_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."bomstylematerialdetail_iid_seq";
CREATE SEQUENCE "public"."bomstylematerialdetail_iid_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for bomstylemst_iid_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."bomstylemst_iid_seq";
CREATE SEQUENCE "public"."bomstylemst_iid_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for bomstylespecmst_iid_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."bomstylespecmst_iid_seq";
CREATE SEQUENCE "public"."bomstylespecmst_iid_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for bomstylespecorderlot_iid_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."bomstylespecorderlot_iid_seq";
CREATE SEQUENCE "public"."bomstylespecorderlot_iid_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for hr_dept_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."hr_dept_id_seq";
CREATE SEQUENCE "public"."hr_dept_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for hr_employee_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."hr_employee_id_seq";
CREATE SEQUENCE "public"."hr_employee_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for material_required_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."material_required_id_seq";
CREATE SEQUENCE "public"."material_required_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for mm_materialcategory_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."mm_materialcategory_id_seq";
CREATE SEQUENCE "public"."mm_materialcategory_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for mm_materialdtl_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."mm_materialdtl_id_seq";
CREATE SEQUENCE "public"."mm_materialdtl_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for mm_materialmst_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."mm_materialmst_id_seq";
CREATE SEQUENCE "public"."mm_materialmst_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for mm_materialsusage_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."mm_materialsusage_id_seq";
CREATE SEQUENCE "public"."mm_materialsusage_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_action_therbligs_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_action_therbligs_id_seq";
CREATE SEQUENCE "public"."model_action_therbligs_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_action_therbligs_type_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_action_therbligs_type_id_seq";
CREATE SEQUENCE "public"."model_action_therbligs_type_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_actionset_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_actionset_id_seq";
CREATE SEQUENCE "public"."model_actionset_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_basic_action_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_basic_action_id_seq";
CREATE SEQUENCE "public"."model_basic_action_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_basic_action_type_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_basic_action_type_id_seq";
CREATE SEQUENCE "public"."model_basic_action_type_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_device_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_device_id_seq";
CREATE SEQUENCE "public"."model_device_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_device_parameter_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_device_parameter_id_seq";
CREATE SEQUENCE "public"."model_device_parameter_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_device_type_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_device_type_id_seq";
CREATE SEQUENCE "public"."model_device_type_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_procedure_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_procedure_id_seq";
CREATE SEQUENCE "public"."model_procedure_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_procedure_set_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_procedure_set_id_seq";
CREATE SEQUENCE "public"."model_procedure_set_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_procedure_sop_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_procedure_sop_id_seq";
CREATE SEQUENCE "public"."model_procedure_sop_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_procedure_technology_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_procedure_technology_id_seq";
CREATE SEQUENCE "public"."model_procedure_technology_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_processfactorydtl_iid_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_processfactorydtl_iid_seq";
CREATE SEQUENCE "public"."model_processfactorydtl_iid_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_produce_action_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_produce_action_id_seq";
CREATE SEQUENCE "public"."model_produce_action_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_produce_action_item_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_produce_action_item_id_seq";
CREATE SEQUENCE "public"."model_produce_action_item_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_produce_line_branch_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_produce_line_branch_id_seq";
CREATE SEQUENCE "public"."model_produce_line_branch_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_produce_line_branch_line_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_produce_line_branch_line_id_seq";
CREATE SEQUENCE "public"."model_produce_line_branch_line_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_produce_line_branch_procedure_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_produce_line_branch_procedure_id_seq";
CREATE SEQUENCE "public"."model_produce_line_branch_procedure_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_produce_line_branch_procedure_line_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_produce_line_branch_procedure_line_id_seq";
CREATE SEQUENCE "public"."model_produce_line_branch_procedure_line_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_produce_line_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_produce_line_id_seq";
CREATE SEQUENCE "public"."model_produce_line_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_produce_procedure_line_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_produce_procedure_line_id_seq";
CREATE SEQUENCE "public"."model_produce_procedure_line_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_product_line_branch_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_product_line_branch_id_seq";
CREATE SEQUENCE "public"."model_product_line_branch_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_product_line_branch_procedure_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_product_line_branch_procedure_id_seq";
CREATE SEQUENCE "public"."model_product_line_branch_procedure_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_product_line_branch_procedure_line_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_product_line_branch_procedure_line_id_seq";
CREATE SEQUENCE "public"."model_product_line_branch_procedure_line_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_product_procedure_dispatch_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_product_procedure_dispatch_id_seq";
CREATE SEQUENCE "public"."model_product_procedure_dispatch_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_product_procedure_line_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_product_procedure_line_id_seq";
CREATE SEQUENCE "public"."model_product_procedure_line_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_product_type_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_product_type_id_seq";
CREATE SEQUENCE "public"."model_product_type_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_technology_flow_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_technology_flow_id_seq";
CREATE SEQUENCE "public"."model_technology_flow_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_technology_flow_type_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_technology_flow_type_id_seq";
CREATE SEQUENCE "public"."model_technology_flow_type_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_technology_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_technology_id_seq";
CREATE SEQUENCE "public"."model_technology_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_technology_set_flow_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_technology_set_flow_id_seq";
CREATE SEQUENCE "public"."model_technology_set_flow_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_technology_set_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_technology_set_id_seq";
CREATE SEQUENCE "public"."model_technology_set_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_technology_set_technology_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_technology_set_technology_id_seq";
CREATE SEQUENCE "public"."model_technology_set_technology_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_technology_sop_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_technology_sop_id_seq";
CREATE SEQUENCE "public"."model_technology_sop_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_technology_type_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_technology_type_id_seq";
CREATE SEQUENCE "public"."model_technology_type_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for model_work_section_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."model_work_section_id_seq";
CREATE SEQUENCE "public"."model_work_section_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for pm_product_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."pm_product_id_seq";
CREATE SEQUENCE "public"."pm_product_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for produce_calendar_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."produce_calendar_id_seq";
CREATE SEQUENCE "public"."produce_calendar_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for produce_calendar_type_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."produce_calendar_type_id_seq";
CREATE SEQUENCE "public"."produce_calendar_type_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for produce_day_report_detail_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."produce_day_report_detail_id_seq";
CREATE SEQUENCE "public"."produce_day_report_detail_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for produce_day_report_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."produce_day_report_id_seq";
CREATE SEQUENCE "public"."produce_day_report_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for produce_line_plan_resource_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."produce_line_plan_resource_id_seq";
CREATE SEQUENCE "public"."produce_line_plan_resource_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 99999999
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for produce_order_product_plan_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."produce_order_product_plan_id_seq";
CREATE SEQUENCE "public"."produce_order_product_plan_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for produce_procedure_resource_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."produce_procedure_resource_id_seq";
CREATE SEQUENCE "public"."produce_procedure_resource_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for produce_wedf_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."produce_wedf_id_seq";
CREATE SEQUENCE "public"."produce_wedf_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for sale_ordermst_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."sale_ordermst_id_seq";
CREATE SEQUENCE "public"."sale_ordermst_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for sale_orderproductnodtl_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."sale_orderproductnodtl_id_seq";
CREATE SEQUENCE "public"."sale_orderproductnodtl_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for sd_material_require_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."sd_material_require_id_seq";
CREATE SEQUENCE "public"."sd_material_require_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for ums_admin_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."ums_admin_id_seq";
CREATE SEQUENCE "public"."ums_admin_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for ums_admin_permission_relation_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."ums_admin_permission_relation_id_seq";
CREATE SEQUENCE "public"."ums_admin_permission_relation_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for ums_admin_role_relation_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."ums_admin_role_relation_id_seq";
CREATE SEQUENCE "public"."ums_admin_role_relation_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for ums_menu_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."ums_menu_id_seq";
CREATE SEQUENCE "public"."ums_menu_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for ums_permission_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."ums_permission_id_seq";
CREATE SEQUENCE "public"."ums_permission_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for ums_resource_category_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."ums_resource_category_id_seq";
CREATE SEQUENCE "public"."ums_resource_category_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for ums_resource_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."ums_resource_id_seq";
CREATE SEQUENCE "public"."ums_resource_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for ums_role_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."ums_role_id_seq";
CREATE SEQUENCE "public"."ums_role_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for ums_role_menu_relation_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."ums_role_menu_relation_id_seq";
CREATE SEQUENCE "public"."ums_role_menu_relation_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for ums_role_permission_relation_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."ums_role_permission_relation_id_seq";
CREATE SEQUENCE "public"."ums_role_permission_relation_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for ums_role_resource_relation_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."ums_role_resource_relation_id_seq";
CREATE SEQUENCE "public"."ums_role_resource_relation_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for wms_box_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."wms_box_id_seq";
CREATE SEQUENCE "public"."wms_box_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for wms_box_type_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."wms_box_type_id_seq";
CREATE SEQUENCE "public"."wms_box_type_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for wms_stockex_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."wms_stockex_id_seq";
CREATE SEQUENCE "public"."wms_stockex_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for wms_stockexmaterial_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."wms_stockexmaterial_id_seq";
CREATE SEQUENCE "public"."wms_stockexmaterial_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for wms_store_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."wms_store_id_seq";
CREATE SEQUENCE "public"."wms_store_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for wms_warehouse_storage_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."wms_warehouse_storage_id_seq";
CREATE SEQUENCE "public"."wms_warehouse_storage_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Table structure for bomstylematerialdetail
-- ----------------------------
DROP TABLE IF EXISTS "public"."bomstylematerialdetail";
CREATE TABLE "public"."bomstylematerialdetail" (
  "iid" int8 NOT NULL DEFAULT nextval('bomstylematerialdetail_iid_seq'::regclass),
  "ibomstylemstid" int4 NOT NULL,
  "imaterialdtlid" int4 NOT NULL,
  "icolorid" int4,
  "isizeid" int4,
  "ibomstylematerialmstid" int4,
  "nwastage" numeric(10,4) NOT NULL,
  "sbomtype" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for bomstylematerialmst
-- ----------------------------
DROP TABLE IF EXISTS "public"."bomstylematerialmst";
CREATE TABLE "public"."bomstylematerialmst" (
  "iid" int4 NOT NULL,
  "ibomstylemstid" int4,
  "iseq" int4,
  "imaterialmstid" int4,
  "spartname" varchar(50) COLLATE "pg_catalog"."default",
  "swidth" varchar(50) COLLATE "pg_catalog"."default",
  "sgmm" varchar(50) COLLATE "pg_catalog"."default",
  "nwastage" numeric(10,4) NOT NULL,
  "sbomtype" varchar(10) COLLATE "pg_catalog"."default" NOT NULL,
  "smaterialtype" varchar(10) COLLATE "pg_catalog"."default" NOT NULL,
  "sremark" varchar(50) COLLATE "pg_catalog"."default",
  "sapprover" varchar(50) COLLATE "pg_catalog"."default",
  "dapproveddate" timestamp(6),
  "bhavedetailmodel" bool,
  "smaterialname" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "smaterialmodel" varchar(200) COLLATE "pg_catalog"."default",
  "ssizetype" varchar(10) COLLATE "pg_catalog"."default",
  "iunitid" int4 NOT NULL,
  "scategorycode" varchar(20) COLLATE "pg_catalog"."default",
  "srealwidth" varchar(200) COLLATE "pg_catalog"."default",
  "srealwidthunit" varchar(10) COLLATE "pg_catalog"."default",
  "scalcedbyorderlot" varchar(100) COLLATE "pg_catalog"."default",
  "scalcedbaglist" varchar(200) COLLATE "pg_catalog"."default",
  "scalcedboxlist" varchar(200) COLLATE "pg_catalog"."default",
  "ibackupunitid" int4,
  "nunitconvertratebutobom" numeric(18,6),
  "srealgmm" varchar(50) COLLATE "pg_catalog"."default",
  "smatchcolorname" varchar(12) COLLATE "pg_catalog"."default",
  "smachinemodel" varchar(100) COLLATE "pg_catalog"."default",
  "bprintedforartnote" bool,
  "smatchcolorcode" varchar(50) COLLATE "pg_catalog"."default",
  "bcoloraber" bool,
  "nshrinkage" numeric(9,2),
  "sformulacode" varchar(50) COLLATE "pg_catalog"."default",
  "nlength" varchar(50) COLLATE "pg_catalog"."default",
  "nlostrate" varchar(50) COLLATE "pg_catalog"."default",
  "ipublicseq" varchar(50) COLLATE "pg_catalog"."default",
  "basacc" varchar(50) COLLATE "pg_catalog"."default",
  "fdeff1" varchar(50) COLLATE "pg_catalog"."default",
  "fdeff2" varchar(50) COLLATE "pg_catalog"."default",
  "fdeff3" varchar(50) COLLATE "pg_catalog"."default",
  "ishowdtlcolr" bool
)
;

-- ----------------------------
-- Table structure for bomstylemst
-- ----------------------------
DROP TABLE IF EXISTS "public"."bomstylemst";
CREATE TABLE "public"."bomstylemst" (
  "iid" int8 NOT NULL DEFAULT nextval('bomstylemst_iid_seq'::regclass),
  "imode" int4,
  "sbillname" varchar(10) COLLATE "pg_catalog"."default",
  "sbomno" varchar(50) COLLATE "pg_catalog"."default",
  "sdeptno" varchar(30) COLLATE "pg_catalog"."default",
  "ismordermstid" int4,
  "iversion" int4,
  "blivedversion" bool,
  "srefno" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "sremark" varchar(500) COLLATE "pg_catalog"."default",
  "istatus" int4,
  "screator" varchar(50) COLLATE "pg_catalog"."default",
  "dcreatedate" timestamp(6),
  "sapprover" varchar(50) COLLATE "pg_catalog"."default",
  "dapproveddate" timestamp(6),
  "ssizeidlist" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "ssizenamelist" varchar(2000) COLLATE "pg_catalog"."default" NOT NULL,
  "scoloridlist" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "scolornamelist" varchar(500) COLLATE "pg_catalog"."default" NOT NULL,
  "smaterialtype" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "sorderno" varchar(50) COLLATE "pg_catalog"."default",
  "syuliaoinfo" varchar(200) COLLATE "pg_catalog"."default",
  "sbomusagetype" varchar(20) COLLATE "pg_catalog"."default",
  "sreforderno" varchar(50) COLLATE "pg_catalog"."default",
  "sinputtypecd" varchar(20) COLLATE "pg_catalog"."default",
  "sartdescription" varchar(2000) COLLATE "pg_catalog"."default",
  "sdatasource" varchar(50) COLLATE "pg_catalog"."default",
  "srefstyleno" varchar(50) COLLATE "pg_catalog"."default",
  "sartuserid" varchar(50) COLLATE "pg_catalog"."default",
  "imatchcolornum" int4,
  "imatchcolornum2" int4
)
;

-- ----------------------------
-- Table structure for bomstylespecbom
-- ----------------------------
DROP TABLE IF EXISTS "public"."bomstylespecbom";
CREATE TABLE "public"."bomstylespecbom" (
  "iid" int4,
  "imaterialmstid" int4,
  "ibomstylespecmstid" int4 NOT NULL,
  "iseq" int4,
  "imaterialdtlid" int4 NOT NULL,
  "spartname" varchar(50) COLLATE "pg_catalog"."default",
  "nrealwidth" numeric(10,2),
  "nlength" numeric(18,2),
  "nwidth" numeric(18,2),
  "iqty" int4,
  "nunitloss" numeric(18,2),
  "nlossrate" numeric(18,2),
  "nloss" numeric(18,2),
  "sexpressioncode" varchar(50) COLLATE "pg_catalog"."default",
  "sremarks" varchar(100) COLLATE "pg_catalog"."default",
  "screator" varchar(20) COLLATE "pg_catalog"."default",
  "dcreatedate" timestamp(6)
)
;

-- ----------------------------
-- Table structure for bomstylespecmst
-- ----------------------------
DROP TABLE IF EXISTS "public"."bomstylespecmst";
CREATE TABLE "public"."bomstylespecmst" (
  "iid" int8 NOT NULL DEFAULT nextval('bomstylespecmst_iid_seq'::regclass),
  "sbillname" varchar(50) COLLATE "pg_catalog"."default",
  "sbillno" varchar(50) COLLATE "pg_catalog"."default",
  "istatus" int4,
  "sdeptno" varchar(50) COLLATE "pg_catalog"."default",
  "icustomerid" int4,
  "sreforderno" varchar(50) COLLATE "pg_catalog"."default",
  "sorderno" varchar(50) COLLATE "pg_catalog"."default",
  "sstyleno" varchar(50) COLLATE "pg_catalog"."default",
  "ddate" timestamp(6),
  "sremark" varchar(500) COLLATE "pg_catalog"."default",
  "screator" varchar(50) COLLATE "pg_catalog"."default",
  "dcreatedate" timestamp(6),
  "sapprover" varchar(50) COLLATE "pg_catalog"."default",
  "dapproveddate" timestamp(6),
  "sspecno" varchar(50) COLLATE "pg_catalog"."default",
  "scustomercomment" varchar(4000) COLLATE "pg_catalog"."default",
  "slotno" varchar(50) COLLATE "pg_catalog"."default",
  "sseqno" varchar(50) COLLATE "pg_catalog"."default",
  "sspectype" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for bomstylespecorderlot
-- ----------------------------
DROP TABLE IF EXISTS "public"."bomstylespecorderlot";
CREATE TABLE "public"."bomstylespecorderlot" (
  "iid" int8 NOT NULL DEFAULT nextval('bomstylespecorderlot_iid_seq'::regclass),
  "ibomstylespecmstid" int4 NOT NULL,
  "slotno" varchar(50) COLLATE "pg_catalog"."default",
  "sproductno" varchar(50) COLLATE "pg_catalog"."default",
  "screator" varchar(50) COLLATE "pg_catalog"."default",
  "dcreatedate" timestamp(6)
)
;

-- ----------------------------
-- Table structure for erp_mrpdtl
-- ----------------------------
DROP TABLE IF EXISTS "public"."erp_mrpdtl";
CREATE TABLE "public"."erp_mrpdtl" (
  "id" int4 NOT NULL,
  "isdmrpmstid" int4 NOT NULL,
  "sproductno" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "slotno" varchar(50) COLLATE "pg_catalog"."default",
  "icolorid" int4,
  "isizeid" int4,
  "isizeqty" int4
)
;

-- ----------------------------
-- Table structure for erp_mrpmaterial
-- ----------------------------
DROP TABLE IF EXISTS "public"."erp_mrpmaterial";
CREATE TABLE "public"."erp_mrpmaterial" (
  "id" int4 NOT NULL,
  "isdmrpdtlid" int4,
  "spartname" varchar(50) COLLATE "pg_catalog"."default",
  "imaterialdtlid" int4 NOT NULL,
  "nwastage" numeric(10,4),
  "nstdqty" numeric(18,2),
  "nmrpqty" numeric(10,2),
  "sremark" varchar(50) COLLATE "pg_catalog"."default",
  "srealwidth" varchar(200) COLLATE "pg_catalog"."default",
  "ibackupunitid" int4,
  "nunitconvertratebutobom" numeric(18,6),
  "srealgmm" varchar(50) COLLATE "pg_catalog"."default",
  "srealmodel" varchar(200) COLLATE "pg_catalog"."default",
  "sbomtype" varchar(50) COLLATE "pg_catalog"."default",
  "iseq" int4
)
;

-- ----------------------------
-- Table structure for erp_mrpmst
-- ----------------------------
DROP TABLE IF EXISTS "public"."erp_mrpmst";
CREATE TABLE "public"."erp_mrpmst" (
  "id" int4 NOT NULL,
  "smrpno" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "sbomno" varchar(50) COLLATE "pg_catalog"."default",
  "sdeptno" varchar(30) COLLATE "pg_catalog"."default",
  "sbillname" varchar(10) COLLATE "pg_catalog"."default" NOT NULL,
  "sreforderno" varchar(50) COLLATE "pg_catalog"."default",
  "sorderno" varchar(50) COLLATE "pg_catalog"."default",
  "sbomtype" varchar(10) COLLATE "pg_catalog"."default",
  "smaterialtype" varchar(50) COLLATE "pg_catalog"."default",
  "istatus" int4,
  "sapprover" varchar(50) COLLATE "pg_catalog"."default",
  "dapproveddate" timestamp(6),
  "screator" varchar(50) COLLATE "pg_catalog"."default",
  "dcreatedate" timestamp(6),
  "sremark" varchar(200) COLLATE "pg_catalog"."default",
  "iversion" int4,
  "isupplierid" int4,
  "ssupplierlinkman" varchar(50) COLLATE "pg_catalog"."default",
  "sapplyuser" varchar(50) COLLATE "pg_catalog"."default",
  "sapplytype" varchar(50) COLLATE "pg_catalog"."default",
  "bsyncid" int4,
  "sprintproductnolist" varchar(50) COLLATE "pg_catalog"."default",
  "scontractno" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for hr_dept
-- ----------------------------
DROP TABLE IF EXISTS "public"."hr_dept";
CREATE TABLE "public"."hr_dept" (
  "id" int8 NOT NULL DEFAULT nextval('hr_dept_id_seq'::regclass),
  "uhrdeptguid" int8,
  "sdeptno" varchar(30) COLLATE "pg_catalog"."default" NOT NULL,
  "sdeptname" varchar(30) COLLATE "pg_catalog"."default" NOT NULL,
  "sdeptfullname" varchar(30) COLLATE "pg_catalog"."default" NOT NULL,
  "sdeptnameen" varchar(50) COLLATE "pg_catalog"."default",
  "sremark" varchar(100) COLLATE "pg_catalog"."default",
  "screator" varchar(20) COLLATE "pg_catalog"."default" NOT NULL,
  "tcreatetime" timestamp(6) NOT NULL,
  "supdateman" varchar(20) COLLATE "pg_catalog"."default",
  "tuptimestamp" timestamp(6) NOT NULL,
  "busable" bool NOT NULL,
  "ifixedpostnumber" int4,
  "iorderno" int4,
  "icompanyid" int4 NOT NULL,
  "bproductdept" bool,
  "sworksectionidlist" varchar(50) COLLATE "pg_catalog"."default",
  "smanager" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for hr_employee
-- ----------------------------
DROP TABLE IF EXISTS "public"."hr_employee";
CREATE TABLE "public"."hr_employee" (
  "id" int8 NOT NULL DEFAULT nextval('hr_employee_id_seq'::regclass),
  "semployeeno" varchar(20) COLLATE "pg_catalog"."default" NOT NULL,
  "semployeenamecn" varchar(20) COLLATE "pg_catalog"."default" NOT NULL,
  "usmuserguid" uuid,
  "uhrjobtitleguid" uuid,
  "uhrdeptguid" uuid,
  "sidcardno" varchar(20) COLLATE "pg_catalog"."default",
  "siccardno" varchar(20) COLLATE "pg_catalog"."default",
  "sarchivesno" varchar(20) COLLATE "pg_catalog"."default",
  "sstatus" varchar(20) COLLATE "pg_catalog"."default" NOT NULL,
  "ssalarytype" varchar(20) COLLATE "pg_catalog"."default",
  "semployeenameen" varchar(30) COLLATE "pg_catalog"."default",
  "ssex" varchar(10) COLLATE "pg_catalog"."default",
  "smarriagestatus" varchar(10) COLLATE "pg_catalog"."default",
  "dbirthday" timestamp(6),
  "snativeplace" varchar(30) COLLATE "pg_catalog"."default",
  "sfolk" varchar(50) COLLATE "pg_catalog"."default",
  "sfamilyaddress" varchar(100) COLLATE "pg_catalog"."default",
  "scurrentaddress" varchar(100) COLLATE "pg_catalog"."default",
  "stelephone" varchar(20) COLLATE "pg_catalog"."default",
  "sfaxno" varchar(20) COLLATE "pg_catalog"."default",
  "sdiploma" varchar(50) COLLATE "pg_catalog"."default",
  "sdegree" varchar(50) COLLATE "pg_catalog"."default",
  "sgraduateschool" varchar(50) COLLATE "pg_catalog"."default",
  "smajor" varchar(20) COLLATE "pg_catalog"."default",
  "dgraduatedate" timestamp(6),
  "spolicykind" varchar(20) COLLATE "pg_catalog"."default",
  "sskill" varchar(30) COLLATE "pg_catalog"."default",
  "denterdate" timestamp(6),
  "dsigncontractdate" timestamp(6),
  "icontractlength" int4,
  "sunit" varchar(10) COLLATE "pg_catalog"."default",
  "sinvitemode" varchar(20) COLLATE "pg_catalog"."default",
  "sintroducer" varchar(50) COLLATE "pg_catalog"."default",
  "dprobationstart" timestamp(6),
  "iprobationmonth" int4,
  "dbecomeregular" timestamp(6),
  "sbecomeregularreason" varchar(50) COLLATE "pg_catalog"."default",
  "ddimissiondate" timestamp(6),
  "sdimissionreason" varchar(50) COLLATE "pg_catalog"."default",
  "sresigntype" varchar(50) COLLATE "pg_catalog"."default",
  "sposition" varchar(50) COLLATE "pg_catalog"."default",
  "sworktype" varchar(50) COLLATE "pg_catalog"."default",
  "sworkproperty" varchar(30) COLLATE "pg_catalog"."default",
  "sremark" varchar(100) COLLATE "pg_catalog"."default",
  "screator" varchar(20) COLLATE "pg_catalog"."default" NOT NULL,
  "tcreatetime" timestamp(6) NOT NULL,
  "supdateman" varchar(20) COLLATE "pg_catalog"."default",
  "tuptimestamp" timestamp(6) NOT NULL,
  "busable" bool NOT NULL,
  "sstaypaper" varchar(50) COLLATE "pg_catalog"."default",
  "sstaylength" varchar(50) COLLATE "pg_catalog"."default",
  "smarrypaper" varchar(50) COLLATE "pg_catalog"."default",
  "smarrylength" varchar(50) COLLATE "pg_catalog"."default",
  "bisinsure" bool,
  "uemequipmentguid" uuid,
  "sworkergroupname" varchar(50) COLLATE "pg_catalog"."default",
  "iprobationdays" int4,
  "icompanyid" int2 NOT NULL,
  "bunion" bool NOT NULL,
  "bct" bool,
  "iprocessfactoryid" int4,
  "shealthstatus" varchar(50) COLLATE "pg_catalog"."default",
  "iiden" int4,
  "sinsuranceno" varchar(50) COLLATE "pg_catalog"."default",
  "sattention" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for maxpriority
-- ----------------------------
DROP TABLE IF EXISTS "public"."maxpriority";
CREATE TABLE "public"."maxpriority" (
  "max" int4
)
;

-- ----------------------------
-- Table structure for mm_materialcategory
-- ----------------------------
DROP TABLE IF EXISTS "public"."mm_materialcategory";
CREATE TABLE "public"."mm_materialcategory" (
  "id" int8 NOT NULL DEFAULT nextval('mm_materialcategory_id_seq'::regclass),
  "scode" varchar(10) COLLATE "pg_catalog"."default" NOT NULL,
  "sparentcode" varchar(50) COLLATE "pg_catalog"."default",
  "scategoryname" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "smaterialtype" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "sremark" varchar(200) COLLATE "pg_catalog"."default",
  "bmaincategory" bool,
  "screator" varchar(50) COLLATE "pg_catalog"."default",
  "dcreatedate" timestamp(6),
  "busable" bool,
  "spurchaserlist" varchar(100) COLLATE "pg_catalog"."default",
  "sworksectionidlist" varchar(100) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for mm_materialdtl
-- ----------------------------
DROP TABLE IF EXISTS "public"."mm_materialdtl";
CREATE TABLE "public"."mm_materialdtl" (
  "id" int8 NOT NULL DEFAULT nextval('mm_materialdtl_id_seq'::regclass),
  "imaterialmstid" int4 NOT NULL,
  "sdtlmaterialcode" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "sdtlfactorycode" varchar(50) COLLATE "pg_catalog"."default",
  "scolorname" varchar(200) COLLATE "pg_catalog"."default",
  "scolornameen" varchar(50) COLLATE "pg_catalog"."default",
  "scolorno" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "scolorserialcode" varchar(50) COLLATE "pg_catalog"."default",
  "icolorid" int4,
  "ssizename" varchar(50) COLLATE "pg_catalog"."default",
  "isizeid" int4,
  "ndtlwhsafeqty" numeric(10,2),
  "ssource" varchar(20) COLLATE "pg_catalog"."default",
  "busable" bool,
  "screator" varchar(50) COLLATE "pg_catalog"."default",
  "dcreatedate" timestamp(6),
  "syarntype" varchar(10) COLLATE "pg_catalog"."default",
  "sitemcode" varchar(50) COLLATE "pg_catalog"."default",
  "scolorpatterncode" varchar(100) COLLATE "pg_catalog"."default",
  "nwastagerate" numeric(9,2),
  "nfixedwastageqty" numeric(10,2),
  "iminmoq" int4,
  "spatternremark" varchar(100) COLLATE "pg_catalog"."default",
  "smodifier" varchar(20) COLLATE "pg_catalog"."default",
  "dupdatedate" timestamp(6),
  "nearlydays" numeric(9)
)
;

-- ----------------------------
-- Table structure for mm_materialmst
-- ----------------------------
DROP TABLE IF EXISTS "public"."mm_materialmst";
CREATE TABLE "public"."mm_materialmst" (
  "id" int8 NOT NULL DEFAULT nextval('mm_materialmst_id_seq'::regclass),
  "iparentid" int4,
  "smaterialcode" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "sfactorycode" varchar(50) COLLATE "pg_catalog"."default",
  "smaterialtype" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "scategorycode" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "sparentcategorycode" varchar(50) COLLATE "pg_catalog"."default",
  "smaterialname" varchar(200) COLLATE "pg_catalog"."default" NOT NULL,
  "smaterialnameen" varchar(200) COLLATE "pg_catalog"."default",
  "smaterialmodel" varchar(200) COLLATE "pg_catalog"."default",
  "smaterialbrand" varchar(50) COLLATE "pg_catalog"."default",
  "swidth" varchar(50) COLLATE "pg_catalog"."default",
  "sgmm" varchar(50) COLLATE "pg_catalog"."default",
  "scomponent" varchar(100) COLLATE "pg_catalog"."default",
  "iunitid" int4 NOT NULL,
  "ipounitid" int4,
  "nunitconvertrate" numeric(18,4),
  "nbaseprice" numeric(10,2),
  "icurrencyid" varchar(50) COLLATE "pg_catalog"."default",
  "nwhsafeqty" numeric(10,2),
  "ssource" varchar(20) COLLATE "pg_catalog"."default",
  "screator" varchar(50) COLLATE "pg_catalog"."default",
  "dcreatedate" timestamp(6),
  "busable" bool,
  "idefaultpurchasect" int4,
  "susagetype" varchar(20) COLLATE "pg_catalog"."default",
  "sprocessingtype" varchar(50) COLLATE "pg_catalog"."default",
  "sfactoryname" varchar(50) COLLATE "pg_catalog"."default",
  "ssampleno" varchar(120) COLLATE "pg_catalog"."default",
  "stechnicsno" varchar(50) COLLATE "pg_catalog"."default",
  "smachinemodel" varchar(100) COLLATE "pg_catalog"."default",
  "slooplength" varchar(200) COLLATE "pg_catalog"."default",
  "soldpaperno" varchar(100) COLLATE "pg_catalog"."default",
  "sremark" varchar(500) COLLATE "pg_catalog"."default",
  "bvirtualmaterial" bool,
  "ttimestamp" timestamp(6) NOT NULL
)
;

-- ----------------------------
-- Table structure for mm_materialsusage
-- ----------------------------
DROP TABLE IF EXISTS "public"."mm_materialsusage";
CREATE TABLE "public"."mm_materialsusage" (
  "id" int8 NOT NULL DEFAULT nextval('mm_materialsusage_id_seq'::regclass),
  "iserial" int4,
  "smaterialtype" varchar(50) COLLATE "pg_catalog"."default",
  "bpercent" bool,
  "flowqty" numeric(10,2),
  "fhightqty" numeric(10,2),
  "fusageqty" numeric(10,2),
  "fpercent" numeric(10,2),
  "bclass" bool,
  "sclassid" varchar(50) COLLATE "pg_catalog"."default",
  "icompanyid" int4,
  "screator" varchar(50) COLLATE "pg_catalog"."default",
  "dcreatedate" timestamp(6),
  "iflag" int4,
  "sremark" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for model_action_therbligs
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_action_therbligs";
CREATE TABLE "public"."model_action_therbligs" (
  "id" int8 NOT NULL DEFAULT nextval('model_action_therbligs_id_seq'::regclass),
  "therbligs_no" varchar(50) COLLATE "pg_catalog"."default",
  "therbligs_name" varchar(50) COLLATE "pg_catalog"."default",
  "therbligs_type_id" int4,
  "mod_value" float8,
  "mod_time" float8,
  "comment" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for model_action_therbligs_type
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_action_therbligs_type";
CREATE TABLE "public"."model_action_therbligs_type" (
  "id" int8 NOT NULL DEFAULT nextval('model_action_therbligs_type_id_seq'::regclass),
  "therbligs_type_no" char(10) COLLATE "pg_catalog"."default",
  "therbligs_type_name" varchar(50) COLLATE "pg_catalog"."default",
  "comment" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for model_actionset
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_actionset";
CREATE TABLE "public"."model_actionset" (
  "id" int8 NOT NULL DEFAULT nextval('model_actionset_id_seq'::regclass),
  "actionset_no" varchar(50) COLLATE "pg_catalog"."default",
  "actionset_name" varchar(50) COLLATE "pg_catalog"."default",
  "comment" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for model_basic_action
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_basic_action";
CREATE TABLE "public"."model_basic_action" (
  "id" int8 NOT NULL DEFAULT nextval('model_basic_action_id_seq'::regclass),
  "basic_action_no" varchar(50) COLLATE "pg_catalog"."default",
  "basic_action_name" varchar(50) COLLATE "pg_catalog"."default",
  "basic_actionset_id" int4,
  "basic_actiontype_id" int4,
  "comment" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for model_basic_action_type
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_basic_action_type";
CREATE TABLE "public"."model_basic_action_type" (
  "id" int8 NOT NULL DEFAULT nextval('model_basic_action_type_id_seq'::regclass),
  "basic_action_type_no" varchar(50) COLLATE "pg_catalog"."default",
  "basic_action_type_name" varchar(50) COLLATE "pg_catalog"."default",
  "comment" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for model_device
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_device";
CREATE TABLE "public"."model_device" (
  "id" int8 NOT NULL DEFAULT nextval('model_device_id_seq'::regclass),
  "device_type_id" int4,
  "device_no" varchar(50) COLLATE "pg_catalog"."default",
  "device_name" varchar(50) COLLATE "pg_catalog"."default",
  "comment" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for model_device_parameter
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_device_parameter";
CREATE TABLE "public"."model_device_parameter" (
  "id" int8 NOT NULL DEFAULT nextval('model_device_parameter_id_seq'::regclass),
  "device_para_no" varchar(50) COLLATE "pg_catalog"."default",
  "device_para_name" varchar(50) COLLATE "pg_catalog"."default",
  "device_id" int8,
  "para_start_value" float8,
  "para_end_value" float8,
  "productivity_speed" float8,
  "productivity_quantity" float8
)
;

-- ----------------------------
-- Table structure for model_device_type
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_device_type";
CREATE TABLE "public"."model_device_type" (
  "id" int8 NOT NULL DEFAULT nextval('model_device_type_id_seq'::regclass),
  "device_type_no" varchar(50) COLLATE "pg_catalog"."default",
  "device_type_name" varchar(50) COLLATE "pg_catalog"."default",
  "parent_id" int8 NOT NULL
)
;

-- ----------------------------
-- Table structure for model_procedure
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_procedure";
CREATE TABLE "public"."model_procedure" (
  "id" int8 NOT NULL DEFAULT nextval('model_procedure_id_seq'::regclass),
  "procedure_no" varchar(50) COLLATE "pg_catalog"."default",
  "procedure_name" varchar(50) COLLATE "pg_catalog"."default",
  "procedure_set_id" int8,
  "product_type_id" int8,
  "unitprice" numeric(18,2),
  "ordered" int4,
  "comment" varchar(100) COLLATE "pg_catalog"."default",
  "standard_work_hours" float8,
  "fee" float8,
  "prepare_time" float4
)
;
COMMENT ON COLUMN "public"."model_procedure"."prepare_time" IS '工序准备时间';

-- ----------------------------
-- Table structure for model_procedure_set
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_procedure_set";
CREATE TABLE "public"."model_procedure_set" (
  "id" int8 NOT NULL DEFAULT nextval('model_procedure_set_id_seq'::regclass),
  "procedure_set_no" varchar(50) COLLATE "pg_catalog"."default",
  "procedure_set_name" varchar(50) COLLATE "pg_catalog"."default",
  "parent_id" int4,
  "work_section_id" int4,
  "comment" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for model_procedure_sop
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_procedure_sop";
CREATE TABLE "public"."model_procedure_sop" (
  "id" int8 NOT NULL DEFAULT nextval('model_procedure_sop_id_seq'::regclass),
  "procedure_id" int4,
  "sop_requirements" varchar(50) COLLATE "pg_catalog"."default",
  "attachment_files" varchar(200) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for model_procedure_technology
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_procedure_technology";
CREATE TABLE "public"."model_procedure_technology" (
  "id" int8 NOT NULL DEFAULT nextval('model_procedure_technology_id_seq'::regclass),
  "procedure_id" int4 NOT NULL,
  "technology_id" int4 NOT NULL,
  "ordered" int4,
  "comment" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for model_processfactory
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_processfactory";
CREATE TABLE "public"."model_processfactory" (
  "id" int4 NOT NULL,
  "sfactorycode" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "sfactoryname" varchar(50) COLLATE "pg_catalog"."default",
  "sdeptno" varchar(50) COLLATE "pg_catalog"."default",
  "sfactoryshortname" varchar(50) COLLATE "pg_catalog"."default",
  "sfactorynameen" varchar(50) COLLATE "pg_catalog"."default",
  "ioutputperday" int4 NOT NULL,
  "sfactoryabbr" varchar(10) COLLATE "pg_catalog"."default",
  "saddress" varchar(50) COLLATE "pg_catalog"."default",
  "sfaxno" varchar(50) COLLATE "pg_catalog"."default",
  "stelno" varchar(50) COLLATE "pg_catalog"."default",
  "scontactman" varchar(50) COLLATE "pg_catalog"."default",
  "semail" varchar(50) COLLATE "pg_catalog"."default",
  "busable" bool,
  "sremark" varchar(50) COLLATE "pg_catalog"."default",
  "screator" varchar(50) COLLATE "pg_catalog"."default",
  "dcreatedate" timestamp(6),
  "blocalfactory" bool,
  "bmasterfactory" bool,
  "nsah" numeric(9,2),
  "sratecode" varchar(20) COLLATE "pg_catalog"."default",
  "imasterfactory" int4,
  "iproductuser" int4,
  "itechuser" int4,
  "iqcuser" int4,
  "icutuser" int4,
  "isewuser" int4,
  "iproductlins" int4,
  "ipackuser" int4
)
;

-- ----------------------------
-- Table structure for model_processfactorydtl
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_processfactorydtl";
CREATE TABLE "public"."model_processfactorydtl" (
  "iid" int8 NOT NULL DEFAULT nextval('model_processfactorydtl_iid_seq'::regclass),
  "ifactoryid" int4 NOT NULL,
  "iyear" int4 NOT NULL,
  "imonth" int4 NOT NULL,
  "iuserqty" int4 NOT NULL,
  "idayqtypermonth" int4 NOT NULL,
  "sremark" varchar(50) COLLATE "pg_catalog"."default",
  "screator" varchar(50) COLLATE "pg_catalog"."default",
  "dcreatedate" timestamp(6),
  "nworkhours" numeric(9,2)
)
;

-- ----------------------------
-- Table structure for model_produce_action
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_produce_action";
CREATE TABLE "public"."model_produce_action" (
  "id" int8 NOT NULL DEFAULT nextval('model_produce_action_id_seq'::regclass),
  "produce_action_no" varchar(50) COLLATE "pg_catalog"."default",
  "produce_action_name" varchar(50) COLLATE "pg_catalog"."default",
  "produce_action_type_id" int4,
  "device_type_id" int4,
  "device_no" varchar(50) COLLATE "pg_catalog"."default",
  "use_time" float8,
  "description" varchar(100) COLLATE "pg_catalog"."default",
  "comment" varchar(100) COLLATE "pg_catalog"."default",
  "visit_time" float8
)
;

-- ----------------------------
-- Table structure for model_produce_action_item
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_produce_action_item";
CREATE TABLE "public"."model_produce_action_item" (
  "id" int8 NOT NULL DEFAULT nextval('model_produce_action_item_id_seq'::regclass),
  "produce_action_id" int4,
  "left_hand_basic_action" varchar(50) COLLATE "pg_catalog"."default",
  "left_action_therbligs" varchar(50) COLLATE "pg_catalog"."default",
  "left_mod_value" float8,
  "right_hand_basic_action1" varchar(50) COLLATE "pg_catalog"."default",
  "right_action_therbligs1" varchar(50) COLLATE "pg_catalog"."default",
  "right_mod_value1" float8,
  "legs_basic_action" varchar(50) COLLATE "pg_catalog"."default",
  "legs_action_therbligs" varchar(50) COLLATE "pg_catalog"."default",
  "legs_mod_value" float8,
  "device_nos" varchar(50) COLLATE "pg_catalog"."default",
  "comment" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for model_produce_action_type
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_produce_action_type";
CREATE TABLE "public"."model_produce_action_type" (
  "id" int4 NOT NULL,
  "produce_action_type_no" varchar(50) COLLATE "pg_catalog"."default",
  "produce_action_type_nane" varchar(50) COLLATE "pg_catalog"."default",
  "comment" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for model_produce_line
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_produce_line";
CREATE TABLE "public"."model_produce_line" (
  "id" int8 NOT NULL DEFAULT nextval('model_produce_line_id_seq'::regclass),
  "produce_line_no" varchar(50) COLLATE "pg_catalog"."default",
  "produce_line_name" varchar(50) COLLATE "pg_catalog"."default",
  "order_id" int8,
  "order_no" varchar(50) COLLATE "pg_catalog"."default",
  "product_id" int8,
  "product_no" varchar(50) COLLATE "pg_catalog"."default",
  "factory_id" int8,
  "factory_name" varchar(50) COLLATE "pg_catalog"."default",
  "ordered" int4,
  "comment" varchar(100) COLLATE "pg_catalog"."default",
  "audittime" timestamp(6) NOT NULL,
  "audituser" varchar(50) COLLATE "pg_catalog"."default",
  "createtime" timestamp(6) NOT NULL,
  "createuser" varchar(50) COLLATE "pg_catalog"."default",
  "updatetime" timestamp(6) NOT NULL,
  "updateuser" varchar(50) COLLATE "pg_catalog"."default",
  "deletetime" timestamp(6) NOT NULL,
  "deleteuser" varchar(50) COLLATE "pg_catalog"."default",
  "isdeleted" bool NOT NULL,
  "status" int4,
  "mod_time" float8,
  "watch_time" varchar(50) COLLATE "pg_catalog"."default",
  "calcute_time_method" varchar(50) COLLATE "pg_catalog"."default",
  "version" varchar(50) COLLATE "pg_catalog"."default",
  "source_line_type" int4
)
;

-- ----------------------------
-- Table structure for model_produce_line_branch
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_produce_line_branch";
CREATE TABLE "public"."model_produce_line_branch" (
  "id" int8 NOT NULL DEFAULT nextval('model_produce_line_branch_id_seq'::regclass),
  "produce_line_branch_no" varchar(50) COLLATE "pg_catalog"."default",
  "produce_line_branch_name" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "comment" varchar(50) COLLATE "pg_catalog"."default",
  "ismain" bool NOT NULL
)
;

-- ----------------------------
-- Table structure for model_produce_line_branch_line
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_produce_line_branch_line";
CREATE TABLE "public"."model_produce_line_branch_line" (
  "id" int8 NOT NULL DEFAULT nextval('model_produce_line_branch_line_id_seq'::regclass),
  "source_line_id" int4 NOT NULL,
  "produce_line_id" int4 NOT NULL,
  "source_line_type" int4
)
;

-- ----------------------------
-- Table structure for model_produce_line_branch_procedure
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_produce_line_branch_procedure";
CREATE TABLE "public"."model_produce_line_branch_procedure" (
  "id" int8 NOT NULL DEFAULT nextval('model_produce_line_branch_procedure_id_seq'::regclass),
  "produce_procedure_branch_id" int4 NOT NULL,
  "procedure_id" int4 NOT NULL
)
;

-- ----------------------------
-- Table structure for model_produce_line_branch_procedure_line
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_produce_line_branch_procedure_line";
CREATE TABLE "public"."model_produce_line_branch_procedure_line" (
  "id" int8 NOT NULL DEFAULT nextval('model_produce_line_branch_procedure_line_id_seq'::regclass),
  "produce_procedure_branch_id" int4 NOT NULL,
  "procedure_line_id" int4 NOT NULL
)
;

-- ----------------------------
-- Table structure for model_produce_procedure_line
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_produce_procedure_line";
CREATE TABLE "public"."model_produce_procedure_line" (
  "id" int8 NOT NULL DEFAULT nextval('model_produce_procedure_line_id_seq'::regclass),
  "produce_procedure_no" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "produce_procedure_name" varchar(50) COLLATE "pg_catalog"."default",
  "product_type_id" int4 NOT NULL,
  "status" int4,
  "comment" varchar(100) COLLATE "pg_catalog"."default",
  "audittime" timestamp(6) NOT NULL,
  "audituser" varchar(50) COLLATE "pg_catalog"."default",
  "createtime" timestamp(6) NOT NULL,
  "createuser" varchar(50) COLLATE "pg_catalog"."default",
  "updatetime" timestamp(6) NOT NULL,
  "updateuser" varchar(50) COLLATE "pg_catalog"."default",
  "deletetime" timestamp(6) NOT NULL,
  "deleteuser" varchar(50) COLLATE "pg_catalog"."default",
  "source" varchar(50) COLLATE "pg_catalog"."default",
  "isdeleted" bool NOT NULL
)
;

-- ----------------------------
-- Table structure for model_product_line_branch
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_product_line_branch";
CREATE TABLE "public"."model_product_line_branch" (
  "id" int8 NOT NULL DEFAULT nextval('model_product_line_branch_id_seq'::regclass),
  "product_procedure_branch_no" varchar(50) COLLATE "pg_catalog"."default",
  "product_procedure_branch_name" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "comment" varchar(50) COLLATE "pg_catalog"."default",
  "ismain" bool NOT NULL
)
;

-- ----------------------------
-- Table structure for model_product_line_branch_procedure
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_product_line_branch_procedure";
CREATE TABLE "public"."model_product_line_branch_procedure" (
  "id" int8 NOT NULL DEFAULT nextval('model_product_line_branch_procedure_id_seq'::regclass),
  "product_procedure_branch_id" int4 NOT NULL,
  "procedure_id" int4 NOT NULL
)
;

-- ----------------------------
-- Table structure for model_product_line_branch_procedure_line
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_product_line_branch_procedure_line";
CREATE TABLE "public"."model_product_line_branch_procedure_line" (
  "id" int8 NOT NULL DEFAULT nextval('model_product_line_branch_procedure_line_id_seq'::regclass),
  "product_procedure_branch_id" int4 NOT NULL,
  "procedure_line_id" int4 NOT NULL
)
;

-- ----------------------------
-- Table structure for model_product_procedure_dispatch
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_product_procedure_dispatch";
CREATE TABLE "public"."model_product_procedure_dispatch" (
  "id" int8 NOT NULL DEFAULT nextval('model_product_procedure_dispatch_id_seq'::regclass),
  "product_procedure_id" int4,
  "factory_id" int4,
  "produce_line_id" int4,
  "createuser" varchar(50) COLLATE "pg_catalog"."default",
  "createtime" timestamp(6),
  "status" int4,
  "comment" varchar(100) COLLATE "pg_catalog"."default",
  "isdeleted" bool NOT NULL,
  "version" varchar(50) COLLATE "pg_catalog"."default",
  "source_line_type" int4
)
;

-- ----------------------------
-- Table structure for model_product_procedure_line
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_product_procedure_line";
CREATE TABLE "public"."model_product_procedure_line" (
  "id" int8 NOT NULL DEFAULT nextval('model_product_procedure_line_id_seq'::regclass),
  "product_procedure_no" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "product_procedure_name" varchar(50) COLLATE "pg_catalog"."default",
  "product_type_id" int4 NOT NULL,
  "status" int4,
  "comment" varchar(100) COLLATE "pg_catalog"."default",
  "audittime" timestamp(6) NOT NULL,
  "audituser" varchar(50) COLLATE "pg_catalog"."default",
  "createtime" timestamp(6) NOT NULL,
  "createuser" varchar(50) COLLATE "pg_catalog"."default",
  "updatetime" timestamp(6) NOT NULL,
  "updateuser" varchar(50) COLLATE "pg_catalog"."default",
  "deletetime" timestamp(6) NOT NULL,
  "deleteuser" varchar(50) COLLATE "pg_catalog"."default",
  "source" varchar(50) COLLATE "pg_catalog"."default",
  "isdeleted" bool NOT NULL,
  "mod_time" float8,
  "watch_time" varchar(50) COLLATE "pg_catalog"."default",
  "calcute_time_method" varchar(50) COLLATE "pg_catalog"."default",
  "order_id" int4,
  "product_id" int8,
  "work_hours" float8,
  "bottleneck_procedure_id" int4,
  "bottleneck_procedure_name" varchar(50) COLLATE "pg_catalog"."default",
  "bottleneck_procedure_work_hours" float8
)
;

-- ----------------------------
-- Table structure for model_product_type
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_product_type";
CREATE TABLE "public"."model_product_type" (
  "id" int8 NOT NULL DEFAULT nextval('model_product_type_id_seq'::regclass),
  "product_type_no" varchar(50) COLLATE "pg_catalog"."default",
  "product_type_name" varchar(50) COLLATE "pg_catalog"."default",
  "comment" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for model_technology
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_technology";
CREATE TABLE "public"."model_technology" (
  "id" int8 NOT NULL DEFAULT nextval('model_technology_id_seq'::regclass),
  "technology_no" varchar(50) COLLATE "pg_catalog"."default",
  "technology_name" varchar(50) COLLATE "pg_catalog"."default",
  "definition" varchar(100) COLLATE "pg_catalog"."default",
  "technology_type_id" int4,
  "enable" bool,
  "comment" varchar(100) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for model_technology_flow
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_technology_flow";
CREATE TABLE "public"."model_technology_flow" (
  "id" int8 NOT NULL DEFAULT nextval('model_technology_flow_id_seq'::regclass),
  "technology_flow_no" varchar(50) COLLATE "pg_catalog"."default",
  "technology_flow_name" varchar(50) COLLATE "pg_catalog"."default",
  "technology_flow_type_id" int4,
  "ordered" int4,
  "description" varchar(100) COLLATE "pg_catalog"."default",
  "parentid" int4,
  "standard_work_hours" float8
)
;

-- ----------------------------
-- Table structure for model_technology_flow_type
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_technology_flow_type";
CREATE TABLE "public"."model_technology_flow_type" (
  "id" int8 NOT NULL DEFAULT nextval('model_technology_flow_type_id_seq'::regclass),
  "technology_flow_type_no" varchar(50) COLLATE "pg_catalog"."default",
  "technology_flow_type_name" varchar(50) COLLATE "pg_catalog"."default",
  "comment" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for model_technology_set
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_technology_set";
CREATE TABLE "public"."model_technology_set" (
  "id" int8 NOT NULL DEFAULT nextval('model_technology_set_id_seq'::regclass),
  "technology_set_no" varchar(50) COLLATE "pg_catalog"."default",
  "technology_set_name" varchar(50) COLLATE "pg_catalog"."default",
  "parent_id" int4,
  "work_section_id" int4,
  "comment" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for model_technology_set_flow
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_technology_set_flow";
CREATE TABLE "public"."model_technology_set_flow" (
  "id" int8 NOT NULL DEFAULT nextval('model_technology_set_flow_id_seq'::regclass),
  "technology_set_id" int4 NOT NULL,
  "technology_flow_id" int4 NOT NULL,
  "ordered" int4,
  "comment" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for model_technology_set_technology
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_technology_set_technology";
CREATE TABLE "public"."model_technology_set_technology" (
  "id" int8 NOT NULL DEFAULT nextval('model_technology_set_technology_id_seq'::regclass),
  "technology_id" int8,
  "technology_set_id" int8
)
;

-- ----------------------------
-- Table structure for model_technology_sop
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_technology_sop";
CREATE TABLE "public"."model_technology_sop" (
  "id" int8 NOT NULL DEFAULT nextval('model_technology_sop_id_seq'::regclass),
  "technology_id" int4,
  "sop_requirements" varchar(50) COLLATE "pg_catalog"."default",
  "attachment_files" varchar(200) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for model_technology_type
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_technology_type";
CREATE TABLE "public"."model_technology_type" (
  "id" int8 NOT NULL DEFAULT nextval('model_technology_type_id_seq'::regclass),
  "technology_type_no" varchar(50) COLLATE "pg_catalog"."default",
  "technology_type_name" varchar(50) COLLATE "pg_catalog"."default",
  "comment" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for model_work_section
-- ----------------------------
DROP TABLE IF EXISTS "public"."model_work_section";
CREATE TABLE "public"."model_work_section" (
  "id" int8 NOT NULL DEFAULT nextval('model_work_section_id_seq'::regclass),
  "work_section_no" varchar(50) COLLATE "pg_catalog"."default",
  "work_section_name" varchar(50) COLLATE "pg_catalog"."default",
  "comment" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for pm_product
-- ----------------------------
DROP TABLE IF EXISTS "public"."pm_product";
CREATE TABLE "public"."pm_product" (
  "id" int8 NOT NULL DEFAULT nextval('pm_product_id_seq'::regclass),
  "no" varchar(20) COLLATE "pg_catalog"."default" NOT NULL,
  "producttypeid" int4 NOT NULL,
  "name" varchar(400) COLLATE "pg_catalog"."default" NOT NULL,
  "shortdescription" varchar(4000) COLLATE "pg_catalog"."default",
  "model" text COLLATE "pg_catalog"."default",
  "stockquantity" int4 NOT NULL,
  "minstockquantity" int4 NOT NULL,
  "orderminimumquantity" int4 NOT NULL,
  "ordermaximumquantity" int4 NOT NULL,
  "price" numeric(18,4) NOT NULL,
  "productcost" numeric(18,4) NOT NULL,
  "weight" numeric(18,4) NOT NULL,
  "length" numeric(18,4) NOT NULL,
  "width" numeric(18,4) NOT NULL,
  "height" numeric(18,4) NOT NULL,
  "availablestarttimestamputc" timestamp(6),
  "availableendtimestamputc" timestamp(6),
  "deleted" bool NOT NULL,
  "createdonutc" timestamp(6) NOT NULL,
  "updatedonutc" timestamp(6) NOT NULL,
  "icon" varchar(200) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for produce_calendar
-- ----------------------------
DROP TABLE IF EXISTS "public"."produce_calendar";
CREATE TABLE "public"."produce_calendar" (
  "id" int8 NOT NULL DEFAULT nextval('produce_calendar_id_seq'::regclass),
  "calendar_name" varchar(50) COLLATE "pg_catalog"."default",
  "calendar_type_id" int4,
  "year_month" varchar(50) COLLATE "pg_catalog"."default",
  "work_days" int4,
  "work_hours" float8,
  "customed" bool,
  "monday" float8,
  "tuesday" float8,
  "wensday" float8,
  "thursday" float8,
  "friday" float8,
  "saturday" float8,
  "sunday" float8,
  "special_work_days" varchar(100) COLLATE "pg_catalog"."default",
  "comment_work" varchar(40) COLLATE "pg_catalog"."default",
  "special_rest_days" varchar(50) COLLATE "pg_catalog"."default",
  "comment_rest" varchar(40) COLLATE "pg_catalog"."default",
  "isdeleted" bool,
  "status" int2
)
;

-- ----------------------------
-- Table structure for produce_calendar_type
-- ----------------------------
DROP TABLE IF EXISTS "public"."produce_calendar_type";
CREATE TABLE "public"."produce_calendar_type" (
  "id" int8 NOT NULL DEFAULT nextval('produce_calendar_type_id_seq'::regclass),
  "calendar_type_no" varchar(50) COLLATE "pg_catalog"."default",
  "calendar_type_name" varchar(50) COLLATE "pg_catalog"."default",
  "parent_id" int8 NOT NULL
)
;

-- ----------------------------
-- Table structure for produce_day_report
-- ----------------------------
DROP TABLE IF EXISTS "public"."produce_day_report";
CREATE TABLE "public"."produce_day_report" (
  "id" int8 NOT NULL DEFAULT nextval('produce_day_report_id_seq'::regclass),
  "order_no" varchar(50) COLLATE "pg_catalog"."default",
  "product_no" varchar(50) COLLATE "pg_catalog"."default",
  "product_name" varchar(50) COLLATE "pg_catalog"."default",
  "procedure_no" varchar(50) COLLATE "pg_catalog"."default",
  "procedure_name" varchar(50) COLLATE "pg_catalog"."default",
  "batch" varchar(50) COLLATE "pg_catalog"."default",
  "total_amount" int8,
  "produced_amount" int8,
  "plan_amount" int8,
  "last_report_date" timestamp(6),
  "schedule_period" varchar(255) COLLATE "pg_catalog"."default",
  "schedule_period_type" int2
)
;
COMMENT ON COLUMN "public"."produce_day_report"."schedule_period" IS '排产周期';
COMMENT ON COLUMN "public"."produce_day_report"."schedule_period_type" IS '周期类型';

-- ----------------------------
-- Table structure for produce_day_report_detail
-- ----------------------------
DROP TABLE IF EXISTS "public"."produce_day_report_detail";
CREATE TABLE "public"."produce_day_report_detail" (
  "id" int8 NOT NULL DEFAULT nextval('produce_day_report_detail_id_seq'::regclass),
  "order_no" varchar(50) COLLATE "pg_catalog"."default",
  "product_no" varchar(50) COLLATE "pg_catalog"."default",
  "product_name" varchar(50) COLLATE "pg_catalog"."default",
  "procedure_no" varchar(50) COLLATE "pg_catalog"."default",
  "procedure_name" varchar(50) COLLATE "pg_catalog"."default",
  "batch" varchar(50) COLLATE "pg_catalog"."default",
  "amount" int8,
  "report_date" timestamp(6),
  "schedule_period" varchar(255) COLLATE "pg_catalog"."default",
  "schedule_period_type" int2
)
;
COMMENT ON COLUMN "public"."produce_day_report_detail"."schedule_period" IS '排产周期';
COMMENT ON COLUMN "public"."produce_day_report_detail"."schedule_period_type" IS '周期类型';

-- ----------------------------
-- Table structure for produce_line_plan_resource
-- ----------------------------
DROP TABLE IF EXISTS "public"."produce_line_plan_resource";
CREATE TABLE "public"."produce_line_plan_resource" (
  "id" int8 NOT NULL DEFAULT nextval('produce_line_plan_resource_id_seq'::regclass),
  "produce_line_id" int8,
  "device_id" int8,
  "device_no" varchar COLLATE "pg_catalog"."default",
  "device_type_id" int4,
  "device_type_name" varchar COLLATE "pg_catalog"."default",
  "employee_ratio" float4,
  "procedure_id" int8,
  "procedure_no" varchar COLLATE "pg_catalog"."default",
  "used_device_amount" int4,
  "used_device_load_factor" float4,
  "unused_device_amount" int8,
  "total_device_load_factor" float4,
  "used_employee_amount" int4,
  "unused_employee_amount" int4,
  "total_employee_load_factor" float8,
  "produce_line_no" varchar COLLATE "pg_catalog"."default",
  "produce_year" int2,
  "produce_month" int2,
  "calendar_id" int4
)
;
COMMENT ON COLUMN "public"."produce_line_plan_resource"."produce_year" IS '排产年份';
COMMENT ON COLUMN "public"."produce_line_plan_resource"."produce_month" IS '排产月份';
COMMENT ON COLUMN "public"."produce_line_plan_resource"."calendar_id" IS '日历ID';

-- ----------------------------
-- Table structure for produce_order_product_plan
-- ----------------------------
DROP TABLE IF EXISTS "public"."produce_order_product_plan";
CREATE TABLE "public"."produce_order_product_plan" (
  "id" int8 NOT NULL DEFAULT nextval('produce_order_product_plan_id_seq'::regclass),
  "order_no" varchar(50) COLLATE "pg_catalog"."default",
  "product_no" varchar(50) COLLATE "pg_catalog"."default",
  "product_name" varchar(50) COLLATE "pg_catalog"."default",
  "produce_line_no" varchar(50) COLLATE "pg_catalog"."default",
  "produce_line_name" varchar(50) COLLATE "pg_catalog"."default",
  "batch" varchar(50) COLLATE "pg_catalog"."default",
  "total_amount" int8,
  "produced_amount" int8,
  "plan_amount" int8,
  "delivery_date" timestamp(6),
  "plan_produce_start_date" timestamp(6),
  "plan_produce_end_date" timestamp(6),
  "duration" float8,
  "latest_produce_start_date" timestamp(6),
  "latest_produce_end_date" timestamp(6),
  "schedule_state" int2,
  "free_float" float8,
  "priority" int4,
  "produce_line_id" int8,
  "schedule_period" varchar(255) COLLATE "pg_catalog"."default",
  "schedule_period_type" int2
)
;
COMMENT ON COLUMN "public"."produce_order_product_plan"."schedule_period" IS '排产周期';
COMMENT ON COLUMN "public"."produce_order_product_plan"."schedule_period_type" IS '周期类型';

-- ----------------------------
-- Table structure for produce_procedure_resource
-- ----------------------------
DROP TABLE IF EXISTS "public"."produce_procedure_resource";
CREATE TABLE "public"."produce_procedure_resource" (
  "id" int8 NOT NULL DEFAULT nextval('produce_procedure_resource_id_seq'::regclass),
  "procedure_id" int4,
  "device_resource_id" int4,
  "device_resource_no" varchar(50) COLLATE "pg_catalog"."default",
  "device_person_ratio" char(10) COLLATE "pg_catalog"."default",
  "priority" int4
)
;

-- ----------------------------
-- Table structure for produce_wedf
-- ----------------------------
DROP TABLE IF EXISTS "public"."produce_wedf";
CREATE TABLE "public"."produce_wedf" (
  "id" int8 NOT NULL DEFAULT nextval('produce_wedf_id_seq'::regclass),
  "product_id" int4,
  "product_no" varchar(50) COLLATE "pg_catalog"."default",
  "materialmst_id" int4,
  "smaterial_code" varchar(50) COLLATE "pg_catalog"."default",
  "sdtlmaterial_id" int4,
  "sdtlmaterial_code" varchar(50) COLLATE "pg_catalog"."default",
  "qty" float8,
  "ratio" float8,
  "unit" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for sale_ordermst
-- ----------------------------
DROP TABLE IF EXISTS "public"."sale_ordermst";
CREATE TABLE "public"."sale_ordermst" (
  "id" int8 NOT NULL DEFAULT nextval('sale_ordermst_id_seq'::regclass),
  "orderno" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "sbillname" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "scontractno" varchar(50) COLLATE "pg_catalog"."default",
  "ssalesid" varchar(50) COLLATE "pg_catalog"."default",
  "dorderdate" timestamp(6) NOT NULL,
  "icustomerid" int4 NOT NULL,
  "sproductserial" varchar(50) COLLATE "pg_catalog"."default",
  "sseasoncode" varchar(50) COLLATE "pg_catalog"."default",
  "sprocesstypecode" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "spaytermcode" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "ncommissionrate" numeric(10,2),
  "sremark" varchar(200) COLLATE "pg_catalog"."default",
  "istatus" int4 NOT NULL,
  "iversion" int4 NOT NULL,
  "screator" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "dcreatedate" timestamp(6) NOT NULL,
  "sdeptno" varchar(30) COLLATE "pg_catalog"."default",
  "sapprover" varchar(20) COLLATE "pg_catalog"."default",
  "dapproveddate" timestamp(6),
  "scontractremark" varchar(1000) COLLATE "pg_catalog"."default",
  "sartuser" varchar(50) COLLATE "pg_catalog"."default",
  "dartreceiveddate" timestamp(6),
  "bartfinished" bool,
  "sordertype" varchar(50) COLLATE "pg_catalog"."default",
  "iproducestatus" int4,
  "iprocessfactoryid" int4,
  "srefstyleno" text COLLATE "pg_catalog"."default",
  "srefcustpono" text COLLATE "pg_catalog"."default",
  "drefdeliverydate" timestamp(6),
  "itotalqty" int4,
  "iagentid" int4,
  "sorgorderno" varchar(50) COLLATE "pg_catalog"."default",
  "srefcustlotstyleno" text COLLATE "pg_catalog"."default",
  "ipaymentday" int4,
  "imanagecompany" int2,
  "scustdeptid" varchar(50) COLLATE "pg_catalog"."default",
  "scustman" varchar(50) COLLATE "pg_catalog"."default",
  "swashid" varchar(50) COLLATE "pg_catalog"."default",
  "ideclfactid" int4,
  "iproductfactid" int4,
  "bcomplete" bool,
  "spricetype" varchar(50) COLLATE "pg_catalog"."default",
  "ssalestype" varchar(50) COLLATE "pg_catalog"."default",
  "sproducestatususerid" varchar(50) COLLATE "pg_catalog"."default",
  "dcompletedate" date,
  "scompleteperson" varchar(50) COLLATE "pg_catalog"."default",
  "scancelproductuserid" varchar(50) COLLATE "pg_catalog"."default",
  "dcancelproductdate" timestamp(6),
  "sexportsalesno" varchar(50) COLLATE "pg_catalog"."default",
  "simportorderno" varchar(50) COLLATE "pg_catalog"."default",
  "dproducedate" date,
  "sordertypecode" varchar(20) COLLATE "pg_catalog"."default",
  "sproducestatususername" varchar(50) COLLATE "pg_catalog"."default",
  "scustsubdept" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for sale_orderproductnodtl
-- ----------------------------
DROP TABLE IF EXISTS "public"."sale_orderproductnodtl";
CREATE TABLE "public"."sale_orderproductnodtl" (
  "id" int8 NOT NULL DEFAULT nextval('sale_orderproductnodtl_id_seq'::regclass),
  "sdorder_id" int4 NOT NULL,
  "product_no" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "product_id" int8 NOT NULL,
  "qty" int4 NOT NULL,
  "seq" int4
)
;

-- ----------------------------
-- Table structure for sd_material_require
-- ----------------------------
DROP TABLE IF EXISTS "public"."sd_material_require";
CREATE TABLE "public"."sd_material_require" (
  "id" int8 NOT NULL DEFAULT nextval('material_required_id_seq'::regclass),
  "arrive_date" varchar(30) COLLATE "pg_catalog"."default",
  "first_week_arrive_date" timestamp(6),
  "first_week_require_amount" float4,
  "fourth_week_arrive_date" timestamp(6),
  "fourth_week_require_amount" float4,
  "material_model" varchar(255) COLLATE "pg_catalog"."default",
  "material_name" varchar(255) COLLATE "pg_catalog"."default",
  "material_no" varchar(255) COLLATE "pg_catalog"."default",
  "ngdnqty" float4,
  "order_no" varchar(255) COLLATE "pg_catalog"."default",
  "schedule_period" varchar(50) COLLATE "pg_catalog"."default",
  "product_amount" float4,
  "product_no" varchar(255) COLLATE "pg_catalog"."default",
  "require_amount" float4,
  "second_week_arrive_date" timestamp(6),
  "second_week_require_amount" float4,
  "third_week_arrive_date" timestamp(6),
  "third_week_require_amount" float4,
  "sprocessingtype" varchar(50) COLLATE "pg_catalog"."default",
  "sfactorycode" varchar(50) COLLATE "pg_catalog"."default",
  "stechnicsno" varchar(50) COLLATE "pg_catalog"."default",
  "nmrpqty" float4
)
;

-- ----------------------------
-- Table structure for ums_admin
-- ----------------------------
DROP TABLE IF EXISTS "public"."ums_admin";
CREATE TABLE "public"."ums_admin" (
  "id" int8 NOT NULL DEFAULT nextval('ums_admin_id_seq'::regclass),
  "username" varchar(64) COLLATE "pg_catalog"."default",
  "password" varchar(64) COLLATE "pg_catalog"."default",
  "icon" varchar(500) COLLATE "pg_catalog"."default",
  "email" varchar(100) COLLATE "pg_catalog"."default",
  "nick_name" varchar(200) COLLATE "pg_catalog"."default",
  "note" varchar(500) COLLATE "pg_catalog"."default",
  "create_time" timestamp(6),
  "login_time" timestamp(6),
  "status" int4
)
;

-- ----------------------------
-- Table structure for ums_admin_permission_relation
-- ----------------------------
DROP TABLE IF EXISTS "public"."ums_admin_permission_relation";
CREATE TABLE "public"."ums_admin_permission_relation" (
  "id" int8 NOT NULL DEFAULT nextval('ums_admin_permission_relation_id_seq'::regclass),
  "admin_id" int8,
  "permission_id" int8,
  "type" int4
)
;

-- ----------------------------
-- Table structure for ums_admin_role_relation
-- ----------------------------
DROP TABLE IF EXISTS "public"."ums_admin_role_relation";
CREATE TABLE "public"."ums_admin_role_relation" (
  "id" int8 NOT NULL DEFAULT nextval('ums_admin_role_relation_id_seq'::regclass),
  "admin_id" int8,
  "role_id" int8
)
;

-- ----------------------------
-- Table structure for ums_menu
-- ----------------------------
DROP TABLE IF EXISTS "public"."ums_menu";
CREATE TABLE "public"."ums_menu" (
  "id" int8 NOT NULL DEFAULT nextval('ums_menu_id_seq'::regclass),
  "parent_id" int8,
  "create_time" timestamp(6),
  "title" varchar(100) COLLATE "pg_catalog"."default",
  "level" int4,
  "sort" int4,
  "name" varchar(100) COLLATE "pg_catalog"."default",
  "icon" varchar(200) COLLATE "pg_catalog"."default",
  "hidden" int4
)
;

-- ----------------------------
-- Table structure for ums_permission
-- ----------------------------
DROP TABLE IF EXISTS "public"."ums_permission";
CREATE TABLE "public"."ums_permission" (
  "id" int8 NOT NULL DEFAULT nextval('ums_permission_id_seq'::regclass),
  "pid" int8,
  "name" varchar(100) COLLATE "pg_catalog"."default",
  "value" varchar(200) COLLATE "pg_catalog"."default",
  "icon" varchar(500) COLLATE "pg_catalog"."default",
  "type" int4,
  "uri" varchar(200) COLLATE "pg_catalog"."default",
  "status" int4,
  "create_time" timestamp(6),
  "sort" int4
)
;

-- ----------------------------
-- Table structure for ums_resource
-- ----------------------------
DROP TABLE IF EXISTS "public"."ums_resource";
CREATE TABLE "public"."ums_resource" (
  "id" int8 NOT NULL DEFAULT nextval('ums_resource_id_seq'::regclass),
  "create_time" timestamp(6),
  "name" varchar(200) COLLATE "pg_catalog"."default",
  "url" varchar(200) COLLATE "pg_catalog"."default",
  "description" varchar(500) COLLATE "pg_catalog"."default",
  "category_id" int8
)
;

-- ----------------------------
-- Table structure for ums_resource_category
-- ----------------------------
DROP TABLE IF EXISTS "public"."ums_resource_category";
CREATE TABLE "public"."ums_resource_category" (
  "id" int8 NOT NULL DEFAULT nextval('ums_resource_category_id_seq'::regclass),
  "create_time" timestamp(6),
  "name" varchar(200) COLLATE "pg_catalog"."default",
  "sort" int4
)
;

-- ----------------------------
-- Table structure for ums_role
-- ----------------------------
DROP TABLE IF EXISTS "public"."ums_role";
CREATE TABLE "public"."ums_role" (
  "id" int8 NOT NULL DEFAULT nextval('ums_role_id_seq'::regclass),
  "name" varchar(100) COLLATE "pg_catalog"."default",
  "description" varchar(500) COLLATE "pg_catalog"."default",
  "admin_count" int4,
  "create_time" timestamp(6),
  "status" int4,
  "sort" int4
)
;

-- ----------------------------
-- Table structure for ums_role_menu_relation
-- ----------------------------
DROP TABLE IF EXISTS "public"."ums_role_menu_relation";
CREATE TABLE "public"."ums_role_menu_relation" (
  "id" int8 NOT NULL DEFAULT nextval('ums_role_menu_relation_id_seq'::regclass),
  "role_id" int8,
  "menu_id" int8
)
;

-- ----------------------------
-- Table structure for ums_role_permission_relation
-- ----------------------------
DROP TABLE IF EXISTS "public"."ums_role_permission_relation";
CREATE TABLE "public"."ums_role_permission_relation" (
  "id" int8 NOT NULL DEFAULT nextval('ums_role_permission_relation_id_seq'::regclass),
  "role_id" int8,
  "permission_id" int8
)
;

-- ----------------------------
-- Table structure for ums_role_resource_relation
-- ----------------------------
DROP TABLE IF EXISTS "public"."ums_role_resource_relation";
CREATE TABLE "public"."ums_role_resource_relation" (
  "id" int8 NOT NULL DEFAULT nextval('ums_role_resource_relation_id_seq'::regclass),
  "role_id" int8,
  "resource_id" int8
)
;

-- ----------------------------
-- Table structure for wms_box
-- ----------------------------
DROP TABLE IF EXISTS "public"."wms_box";
CREATE TABLE "public"."wms_box" (
  "id" int8 NOT NULL DEFAULT nextval('wms_box_id_seq'::regclass),
  "name" varchar(50) COLLATE "pg_catalog"."default",
  "typeid" int4,
  "tenantid" int4
)
;

-- ----------------------------
-- Table structure for wms_box_type
-- ----------------------------
DROP TABLE IF EXISTS "public"."wms_box_type";
CREATE TABLE "public"."wms_box_type" (
  "id" int8 NOT NULL DEFAULT nextval('wms_box_type_id_seq'::regclass),
  "no" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "name" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "length" float8,
  "width" float8,
  "height" float8,
  "comment" varchar(100) COLLATE "pg_catalog"."default",
  "createtime" timestamp(6),
  "createuser" varchar(50) COLLATE "pg_catalog"."default",
  "uptimestamp" timestamp(6),
  "updateuser" varchar(50) COLLATE "pg_catalog"."default",
  "deletetime" timestamp(6),
  "deleteuser" varchar(50) COLLATE "pg_catalog"."default",
  "tenantid" varchar(50) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for wms_stock
-- ----------------------------
DROP TABLE IF EXISTS "public"."wms_stock";
CREATE TABLE "public"."wms_stock" (
  "id" int4 NOT NULL,
  "istoreid" int4,
  "iimindtlid" int4 NOT NULL,
  "imaterialdtlid" int4 NOT NULL,
  "ninqty" numeric(18,2) NOT NULL,
  "ninstockqty" numeric(18,2) NOT NULL,
  "nstockqty" numeric(18,2) NOT NULL,
  "istockunitid" int4 NOT NULL,
  "ngdnqty" numeric(18,2),
  "nrtwqty" numeric(18,2),
  "nrtsqty" numeric(18,2),
  "nreservedqty" int4,
  "slocationname" varchar(50) COLLATE "pg_catalog"."default",
  "bpublic" bit(1),
  "dpublicdate" timestamp(6),
  "spublicuser" varchar(50) COLLATE "pg_catalog"."default",
  "spublicremark" varchar(100) COLLATE "pg_catalog"."default",
  "ncountqty" numeric(14,2),
  "fstockweight" numeric(9,2)
)
;

-- ----------------------------
-- Table structure for wms_stockex
-- ----------------------------
DROP TABLE IF EXISTS "public"."wms_stockex";
CREATE TABLE "public"."wms_stockex" (
  "id" int8 NOT NULL DEFAULT nextval('wms_stockex_id_seq'::regclass),
  "istoreid" int4 NOT NULL,
  "istockexmaterialid" int4 NOT NULL,
  "ninqty" numeric(18,2),
  "iinunitid" int4,
  "nunitconvertrate" numeric(18,4),
  "ninstockqty" numeric(18,2),
  "nstockqty" numeric(18,2),
  "istockunitid" int4,
  "ngdnqty" numeric(18,2),
  "nrtwqty" numeric(18,2),
  "nrtsqty" numeric(18,2),
  "nreservedqty" numeric(18,2),
  "nstockprice" numeric(18,8),
  "nstockamount" numeric(18,2),
  "slocationname" varchar(50) COLLATE "pg_catalog"."default",
  "bpublic" bool,
  "dpublicdate" timestamp(6),
  "spublicuser" varchar(50) COLLATE "pg_catalog"."default",
  "spublicremark" varchar(50) COLLATE "pg_catalog"."default",
  "iimstockexmaterialid" int4,
  "ipounitid" int4,
  "ncountqty" numeric(18,4),
  "sremark" varchar(500) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for wms_stockexmaterial
-- ----------------------------
DROP TABLE IF EXISTS "public"."wms_stockexmaterial";
CREATE TABLE "public"."wms_stockexmaterial" (
  "id" int8 NOT NULL DEFAULT nextval('wms_stockexmaterial_id_seq'::regclass),
  "sorderno" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "smpsno" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "sstyleno" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "sproductno" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "imaterialdtlid" int4 NOT NULL,
  "srealwidth" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "srealgmm" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "smateriallotno" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "busable" bool NOT NULL,
  "srealmodel" varchar(50) COLLATE "pg_catalog"."default",
  "bpublic" bool,
  "dpublicdate" timestamp(6),
  "spublicremark" varchar(500) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Table structure for wms_store
-- ----------------------------
DROP TABLE IF EXISTS "public"."wms_store";
CREATE TABLE "public"."wms_store" (
  "id" int8 NOT NULL DEFAULT nextval('wms_store_id_seq'::regclass),
  "smaterialtype" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "sproducttype" varchar(50) COLLATE "pg_catalog"."default",
  "sstorecode" varchar(10) COLLATE "pg_catalog"."default",
  "sstorename" varchar(50) COLLATE "pg_catalog"."default",
  "icompanyid" int4 NOT NULL,
  "busable" bool,
  "sremark" varchar(50) COLLATE "pg_catalog"."default",
  "screator" varchar(50) COLLATE "pg_catalog"."default",
  "dcreatedate" timestamp(6),
  "icuprocessfactoryid" int4
)
;

-- ----------------------------
-- Table structure for wms_warehouse_storage
-- ----------------------------
DROP TABLE IF EXISTS "public"."wms_warehouse_storage";
CREATE TABLE "public"."wms_warehouse_storage" (
  "id" int8 NOT NULL DEFAULT nextval('wms_warehouse_storage_id_seq'::regclass),
  "meterial_no" varchar COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "meterial_type" varchar COLLATE "pg_catalog"."default",
  "qty" int8,
  "meterial_name" varchar COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Function structure for getmonthgantt
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."getmonthgantt"("monthsel" date);
CREATE OR REPLACE FUNCTION "public"."getmonthgantt"("monthsel" date)
  RETURNS TABLE("id" int8, "text" text, "start_date" timestamp, "duration" float8, "progress" float8) AS $BODY$

begin
   return query SELECT POPP.ID,
	CONCAT(PRODUCE_LINE_NAME,
		'-',
		ORDER_NO,
		'-',
		PRODUCT_NAME) AS text,
 	  CASE
					WHEN PLAN_PRODUCE_START_DATE <= MONTHSEL THEN MONTHSEL
					ELSE PLAN_PRODUCE_START_DATE
	END
AS START_DATE,
	cast (extract(epoch from (CASE            when PLAN_PRODUCE_END_DATE >= (MONTHSEL + interval '1 month') and plan_produce_start_Date<= monthSel then monthSel + interval '1 month' - monthSel
					WHEN PLAN_PRODUCE_END_DATE >= (MONTHSEL + interval '1 month') THEN MONTHSEL + interval '1 month' - PLAN_PRODUCE_START_DATE
					ELSE PLAN_PRODUCE_END_DATE - MONTHSEL
	END)) / (3600*24) as float)
AS DURATION,
	cast ((EXTRACT(EPOCH  FROM (CASE
				    when PLAN_PRODUCE_END_DATE >= (MONTHSEL + interval '1 month') and plan_produce_start_Date<= monthSel then monthSel + interval '1 month' - monthSel
					WHEN PLAN_PRODUCE_END_DATE >= (MONTHSEL + interval '1 month') THEN MONTHSEL + interval '1 month' - PLAN_PRODUCE_START_DATE
					ELSE PLAN_PRODUCE_END_DATE - MONTHSEL
	END)) / EXTRACT( EPOCH  FROM (POPP.PLAN_PRODUCE_END_DATE-popp.PLAN_PRODUCE_START_DATE))) * PLAN_AMOUNT  as float) AS PROGRESs
FROM PRODUCE_ORDER_PRODUCT_PLAN POPP
WHERE (MONTHSEL,
								MONTHSEL + interval '1 month') OVERLAPS (PLAN_PRODUCE_START_DATE::date,PLAN_PRODUCE_END_DATE::date)
								AND PLAN_PRODUCE_START_DATE IS NOT NULL AND PLAN_PRODUCE_END_DATE IS NOT NULL
								order by plan_produce_START_DATE asc;
								

end;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100
  ROWS 1000;

-- ----------------------------
-- Function structure for iif
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."iif"("condition" bool, "true_result" float8, "false_result" float8);
CREATE OR REPLACE FUNCTION "public"."iif"("condition" bool, "true_result" float8, "false_result" float8)
  RETURNS "pg_catalog"."text" AS $BODY$
    BEGIN
     IF condition THEN
        RETURN true_result;
     ELSE
        RETURN false_result;
     END IF;
    END
    $BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for iif
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."iif"("condition" bool, "true_result" text, "false_result" text);
CREATE OR REPLACE FUNCTION "public"."iif"("condition" bool, "true_result" text, "false_result" text)
  RETURNS "pg_catalog"."text" AS $BODY$
    BEGIN
     IF condition THEN
        RETURN true_result;
     ELSE
        RETURN false_result;
     END IF;
    END
    $BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Procedure structure for save_processreport
-- ----------------------------
DROP PROCEDURE IF EXISTS "public"."save_processreport"("id" int8, "orderno" varchar, "productno" varchar, "productname" varchar, "procedureno" varchar, "procedurename" varchar, "_batch" varchar, "totalamount" int8, "producedamount" int8, "planamount" int8, "lastreportdate" timestamp, "scheduleperiod" varchar, "scheduleperiodtype" int4);
CREATE OR REPLACE PROCEDURE "public"."save_processreport"("id" int8, "orderno" varchar, "productno" varchar, "productname" varchar, "procedureno" varchar, "procedurename" varchar, "_batch" varchar, "totalamount" int8, "producedamount" int8, "planamount" int8, "lastreportdate" timestamp, "scheduleperiod" varchar, "scheduleperiodtype" int4)
 AS $BODY$
BEGIN
		if not EXISTS(select count(*) from produce_day_report where order_no = orderno and product_no = productno 
		and procedure_no = procedureno and batch = _batch) then
 		insert into produce_day_report values(nextval('produce_day_report_id_seq'),orderno,productno,productname, procedureno, procedurename,_batch, totalAmount, producedAmount,planAmount,lastReportDate,schedulePeriod,schedulePeriodType);
		end if;
	
END; 
$BODY$
  LANGUAGE plpgsql;

-- ----------------------------
-- Procedure structure for save_processreport_detail
-- ----------------------------
DROP PROCEDURE IF EXISTS "public"."save_processreport_detail"("id" int8, "orderno" varchar, "productno" varchar, "productname" varchar, "procedureno" varchar, "procedurename" varchar, "_batch" varchar, "_amount" int8, "reportdate" timestamp, "scheduleperiod" varchar, "scheduleperiodtype" int4);
CREATE OR REPLACE PROCEDURE "public"."save_processreport_detail"("id" int8, "orderno" varchar, "productno" varchar, "productname" varchar, "procedureno" varchar, "procedurename" varchar, "_batch" varchar, "_amount" int8, "reportdate" timestamp, "scheduleperiod" varchar, "scheduleperiodtype" int4)
 AS $BODY$

DECLARE old_amount BIGINT := 0; 
BEGIN
IF id > 0 THEN
		begin
		SELECT  amount into old_amount FROM produce_day_report_Detail WHERE id = id;
	
		UPDATE produce_day_report_detail pdrd
	
		SET order_no = orderno,
			product_no = productno,
			product_name = productname,
			procedure_no = procedureno,
			procedure_name = procedurename,
			amount = _amount,
			report_Date = current_date,
			schedule_period=schedulePeriod,
			schedule_Period_type = schedulePeriodtype
		WHERE pdrd.id = id;

		if not EXISTS(select count(*) from produce_day_report where order_no = orderno and product_no = productno 
		and procedure_no = procedureno and batch = _batch   and schedule_Period = schedulePeriod
			  and schedule_Period_type = schedulePeriodType) then
-- 		insert into produce_day_report values(nextval('produce_day_report_id_seq'),orderno,productno,productname, procedureno, procedurename,_batch, _amount, current_date);
		
		else

		UPDATE produce_day_report
		SET produced_amount = produced_amount + _amount,
			plan_amount = plan_amount - _amount,
			last_report_Date = current_date
		WHERE order_no = orderno
			  AND product_no = productno
			  AND procedure_no = procedureno
			  and schedule_Period = schedulePeriod
			  and schedule_Period_type = schedulePeriodType
			  AND batch = _batch;
		end if;
	 END;
ELSE
   BEGIN
  	INSERT INTO  Produce_Day_Report_Detail
		(
		  id,
			ORDER_no,
			product_no,
			product_name,
			procedure_no,
			procedure_name,
			batch,
			amount,
			report_date,
			 schedule_Period ,
			 chedule_Period_type
		)
		VALUES
		( nextval('produce_day_report_detail_id_seq'),orderno, productno, productname, procedureno, procedurename, _batch, _amount, current_date,schedulePeriod,schedulePeriodType);
		
		if not EXISTS(select count(*) from produce_day_report where order_no = orderno and product_no = productno 
		and procedure_no = procedureno  and batch = _batch   and schedule_Period = schedulePeriod
			  and schedule_Period_type = schedulePeriodType) then
-- 		insert into produce_day_report values(nextval('produce_day_report_id_seq'),orderno,productno,productname, procedureno, procedurename,_batch, _amount, current_date);
		
		else

		UPDATE produce_day_report
		SET produced_amount = produced_amount + _amount,
			plan_amount = plan_amount - _amount,
			last_report_Date = current_date
		WHERE order_no = orderno
			  AND product_no = productno
			  AND procedure_no = procedureno
			  and schedule_Period = schedulePeriod
			  and schedule_Period_type = schedulePeriodType
			  AND batch = _batch;
		end if;
	END;
END IF;
END; 
$BODY$
  LANGUAGE plpgsql;

-- ----------------------------
-- Procedure structure for usp_getMonthGantt
-- ----------------------------
DROP PROCEDURE IF EXISTS "public"."usp_getMonthGantt"("monthSel" date);
CREATE OR REPLACE PROCEDURE "public"."usp_getMonthGantt"("monthSel" date)
 AS $BODY$
create or replace function getMonthGantt(monthSel Date)
RETURNS refcursor
as $body$
declare ref refcursor
begin
   opeb ref for SELECT ID,
	CONCAT(PRODUCE_LINE_NAME,
		'-',
		ORDER_NO,
		'-',
		PRODUCT_NAME) AS text,
	CASE
					WHEN PLAN_PRODUCE_START_DATE <= MONTHSEL THEN MONTHSEL
					ELSE PLAN_PRODUCE_START_DATE
	END 
AS START_DATE,
	CASE
					WHEN PLAN_PRODUCE_END_DATE >= (MONTHSEL + interval '1 month') THEN MONTHSEL + interval '1 month' - PLAN_PRODUCE_START_DATE
					ELSE PLAN_PRODUCE_END_DATE - MONTHSEL
	END 
AS DURATION,
	DURATION / DURATION * PLAN_AMOUNT AS PROGRESS
FROM PRODUCE_ORDER_PRODUCT_PLAN POPP
WHERE (MONTHSEL,
								MONTHSEL + interval '1 month') OVERLAPS (PLAN_PRODUCE_START_DATE::date,PLAN_PRODUCE_END_DATE::date)
								order by plan_produce_START_DATE asc;
								return ref;
								
end $body$;
$BODY$
  LANGUAGE sql;

-- ----------------------------
-- Procedure structure for usp_produce_order_product_planinsert
-- ----------------------------
DROP PROCEDURE IF EXISTS "public"."usp_produce_order_product_planinsert"("order_no" varchar, "product_no" varchar, "product_name" varchar, "produce_line_no" varchar, "produce_line_name" varchar, "batch" varchar, "total_amount" int4, "produced_amount" int4, "plan_amount" int4, "delivery_date" timestamp, "plan_produce_start_date" timestamp, "plan_produce_end_date" timestamp, "duration" float8, "latest_produce_start_date" timestamp, "schedule_sate" int4, "free_float" float8, "priority" int4, "scheduleperiod" varchar, "scheduleperiodtype" int4);
CREATE OR REPLACE PROCEDURE "public"."usp_produce_order_product_planinsert"("order_no" varchar, "product_no" varchar, "product_name" varchar, "produce_line_no" varchar, "produce_line_name" varchar, "batch" varchar, "total_amount" int4, "produced_amount" int4, "plan_amount" int4, "delivery_date" timestamp, "plan_produce_start_date" timestamp, "plan_produce_end_date" timestamp, "duration" float8, "latest_produce_start_date" timestamp, "schedule_sate" int4, "free_float" float8, "priority" int4, "scheduleperiod" varchar, "scheduleperiodtype" int4)
 AS $BODY$

DECLARE maxId INTeger;
DECLARE maxpriority INTeger :=0 ;
begin
INSERT INTO Produce_Order_Product_Plan (order_no, product_no, product_name, produce_line_no, produce_line_name, batch, total_amount, produced_amount, plan_amount, delivery_date, plan_produce_start_date, plan_produce_end_date, duration, latest_produce_start_Date, schedule_state, free_float, priority,schedule_period,schedule_period_type)
SELECT order_no, product_no, product_name, produce_line_no, produce_line_name, batch, total_amount, produced_amount, plan_amount, delivery_date, plan_produce_start_date, plan_produce_end_date, duration, latest_produce_start_Date, schedule_sate, free_float, priority,schedulePeriod,schedulePeriodType;


select  nextval('Produce_Order_Product_Plan_id_seq') into maxid;
SELECT max(Produce_Order_Product_Plan.priority) into maxpriority  FROM Produce_Order_Product_Plan WHERE ID <> maxId;

UPDATE Produce_Order_Product_Plan SET priority = maxpriority+1 WHERE id = maxId;


--如果资源配置表不存在记录则插入默认？



end;
$BODY$
  LANGUAGE plpgsql;

-- ----------------------------
-- Procedure structure for usp_produce_order_product_planupdate
-- ----------------------------
DROP PROCEDURE IF EXISTS "public"."usp_produce_order_product_planupdate"("id" int4, "order_no" varchar, "product_no" varchar, "product_name" varchar, "produce_line_no" varchar, "produce_line_name" varchar, "batch" varchar, "total_amount" int8, "produced_amount" int8, "plan_amount" int8, "delivery_date" timestamp, "plan_produce_start_date" timestamp, "plan_produce_end_date" timestamp, "duration" float8, "latest_produce_start_date" timestamp, "schedule_sate" int2, "free_float" float8, "priority" int4);
CREATE OR REPLACE PROCEDURE "public"."usp_produce_order_product_planupdate"("id" int4, "order_no" varchar=NULL::character varying, "product_no" varchar=NULL::character varying, "product_name" varchar=NULL::character varying, "produce_line_no" varchar=NULL::character varying, "produce_line_name" varchar=NULL::character varying, "batch" varchar=NULL::character varying, "total_amount" int8=NULL::bigint, "produced_amount" int8=NULL::bigint, "plan_amount" int8=NULL::bigint, "delivery_date" timestamp=NULL::timestamp without time zone, "plan_produce_start_date" timestamp=NULL::timestamp without time zone, "plan_produce_end_date" timestamp=NULL::timestamp without time zone, "duration" float8=NULL::double precision, "latest_produce_start_date" timestamp=NULL::timestamp without time zone, "schedule_sate" int2=NULL::smallint, "free_float" float8=NULL::double precision, "priority" int4=NULL::integer)
 AS $BODY$
begin
UPDATE Produce_Order_Product_Plan
SET    order_no = order_no, product_no = product_no, product_name = product_name, produce_line_no = produce_line_no, produce_line_name = produce_line_name, batch = batch, total_amount = total_amount, produced_amount = produced_amount, plan_amount = plan_amount, delivery_date = delivery_date, plan_produce_start_date = plan_produce_start_date, plan_produce_end_date = plan_produce_end_date, duration = duration, latest_produce_start_Date = latest_produce_start_Date, schedule_state = schedule_sate, free_float = free_float, priority = priority
WHERE  id = id;

-- Begin Return Select <- do not remove
SELECT id, order_no, product_no, product_name, produce_line_no, produce_line_name, batch, total_amount, produced_amount, plan_amount, delivery_date, plan_produce_start_date, plan_produce_end_date, duration, latest_produce_start_Date, schedule_state, free_float, priority
FROM   Produce_Order_Product_Plan
WHERE  id = id;
-- End Return Select <- do not remove
end;
$BODY$
  LANGUAGE plpgsql;

-- ----------------------------
-- Function structure for usp_producelineresource_insert
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."usp_producelineresource_insert"("producelineid" int8, "producelineno" varchar, "proceduress" _int8, "produceyear" int4, "producemonth" int4);
CREATE OR REPLACE FUNCTION "public"."usp_producelineresource_insert"("producelineid" int8, "producelineno" varchar, "proceduress" _int8, "produceyear" int4, "producemonth" int4)
  RETURNS "pg_catalog"."void" AS $BODY$

DECLARE _cur REFCURSOR;
DECLARE _rec record;
DECLARE _totaldeviceamount integer:=0;
DECLARE _totalemployeeamount integer:=0;

 BEGIN
 
 		if not EXISTS(select * from produce_line_plan_resource where produce_line_id = producelineid) then
		
  	for _rec in (select 
	    a.Id,
        a.Procedure_No,
        a.Procedure_Name,
        c.Procedure_Set_Name,
        b.Product_Type_Name,
        e.Device_Name,
        e.Device_No,
				e.id as device_id,
        d.Priority,
        d.Device_Person_Ratio,
		e.device_type_id,
		f.device_type_name
        FROM public.Model_Procedure a
        INNER JOIN public.Model_Product_Type b
        ON a.Product_Type_Id = b.Id
        INNER JOIN public.Model_Procedure_Set c
        ON a.Procedure_Set_Id = c.Id
        LEFT JOIN Produce_Procedure_Resource d
        ON a.Id = d.Procedure_Id
        LEFT JOIN public.Model_Device e
        ON d.Device_Resource_Id = e.Id
		left join model_device_type f
		on e.device_type_id = f.id
		where a.Id = any(proceduress)) loop
		


	 
	   select qty from wms_warehouse_storage where meterial_no=_rec.device_no into _totaldeviceamount ;
	   select count(*)   from hr_employee where sworktype = _rec.procedure_name into _totalemployeeamount;
	   insert into produce_line_plan_resource values(nextval('public.produce_line_plan_resource_id_seq'),
		                                             producelineid,
													 _rec.device_id,
													 _rec.Device_No,
													 _rec.device_type_id,
													 _rec.device_type_name,
													 cast(substring(_rec.Device_Person_Ratio,position(':' in _rec.Device_Person_Ratio)+1) as real),
													 _rec.id,
		                                             _rec.procedure_no,
													 0,
		                                             _totaldeviceamount,
		                                             _totaldeviceamount,
		                                             0,
		                                             0,
		                                            
		                                             _totalemployeeamount,
													 _totalemployeeamount,
		                                             producelineno,
													 produceYear,
													 produceMonth);
		end loop;
		--close _cur;
end IF;
END;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."bomstylematerialdetail_iid_seq"
OWNED BY "public"."bomstylematerialdetail"."iid";
SELECT setval('"public"."bomstylematerialdetail_iid_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."bomstylemst_iid_seq"
OWNED BY "public"."bomstylemst"."iid";
SELECT setval('"public"."bomstylemst_iid_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."bomstylespecmst_iid_seq"
OWNED BY "public"."bomstylespecmst"."iid";
SELECT setval('"public"."bomstylespecmst_iid_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."bomstylespecorderlot_iid_seq"
OWNED BY "public"."bomstylespecorderlot"."iid";
SELECT setval('"public"."bomstylespecorderlot_iid_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."hr_dept_id_seq"
OWNED BY "public"."hr_dept"."id";
SELECT setval('"public"."hr_dept_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."hr_employee_id_seq"
OWNED BY "public"."hr_employee"."id";
SELECT setval('"public"."hr_employee_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."material_required_id_seq"
OWNED BY "public"."sd_material_require"."id";
SELECT setval('"public"."material_required_id_seq"', 19, true);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."mm_materialcategory_id_seq"
OWNED BY "public"."mm_materialcategory"."id";
SELECT setval('"public"."mm_materialcategory_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."mm_materialdtl_id_seq"
OWNED BY "public"."mm_materialdtl"."id";
SELECT setval('"public"."mm_materialdtl_id_seq"', 2, true);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."mm_materialmst_id_seq"
OWNED BY "public"."mm_materialmst"."id";
SELECT setval('"public"."mm_materialmst_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."mm_materialsusage_id_seq"
OWNED BY "public"."mm_materialsusage"."id";
SELECT setval('"public"."mm_materialsusage_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_action_therbligs_id_seq"
OWNED BY "public"."model_action_therbligs"."id";
SELECT setval('"public"."model_action_therbligs_id_seq"', 3, true);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_action_therbligs_type_id_seq"
OWNED BY "public"."model_action_therbligs_type"."id";
SELECT setval('"public"."model_action_therbligs_type_id_seq"', 2, true);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_actionset_id_seq"
OWNED BY "public"."model_actionset"."id";
SELECT setval('"public"."model_actionset_id_seq"', 4, true);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_basic_action_id_seq"
OWNED BY "public"."model_basic_action"."id";
SELECT setval('"public"."model_basic_action_id_seq"', 2, true);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_basic_action_type_id_seq"
OWNED BY "public"."model_basic_action_type"."id";
SELECT setval('"public"."model_basic_action_type_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_device_id_seq"
OWNED BY "public"."model_device"."id";
SELECT setval('"public"."model_device_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_device_parameter_id_seq"
OWNED BY "public"."model_device_parameter"."id";
SELECT setval('"public"."model_device_parameter_id_seq"', 20010, true);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_device_type_id_seq"
OWNED BY "public"."model_device_type"."id";
SELECT setval('"public"."model_device_type_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_procedure_id_seq"
OWNED BY "public"."model_procedure"."id";
SELECT setval('"public"."model_procedure_id_seq"', 6, true);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_procedure_set_id_seq"
OWNED BY "public"."model_procedure_set"."id";
SELECT setval('"public"."model_procedure_set_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_procedure_sop_id_seq"
OWNED BY "public"."model_procedure_sop"."id";
SELECT setval('"public"."model_procedure_sop_id_seq"', 2, true);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_procedure_technology_id_seq"
OWNED BY "public"."model_procedure_technology"."id";
SELECT setval('"public"."model_procedure_technology_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_processfactorydtl_iid_seq"
OWNED BY "public"."model_processfactorydtl"."iid";
SELECT setval('"public"."model_processfactorydtl_iid_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_produce_action_id_seq"
OWNED BY "public"."model_produce_action"."id";
SELECT setval('"public"."model_produce_action_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_produce_action_item_id_seq"
OWNED BY "public"."model_produce_action_item"."id";
SELECT setval('"public"."model_produce_action_item_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_produce_line_branch_id_seq"
OWNED BY "public"."model_produce_line_branch"."id";
SELECT setval('"public"."model_produce_line_branch_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_produce_line_branch_line_id_seq"
OWNED BY "public"."model_produce_line_branch_line"."id";
SELECT setval('"public"."model_produce_line_branch_line_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_produce_line_branch_procedure_id_seq"
OWNED BY "public"."model_produce_line_branch_procedure"."id";
SELECT setval('"public"."model_produce_line_branch_procedure_id_seq"', 2, true);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_produce_line_branch_procedure_line_id_seq"
OWNED BY "public"."model_produce_line_branch_procedure_line"."id";
SELECT setval('"public"."model_produce_line_branch_procedure_line_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_produce_line_id_seq"
OWNED BY "public"."model_produce_line"."id";
SELECT setval('"public"."model_produce_line_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_produce_procedure_line_id_seq"
OWNED BY "public"."model_produce_procedure_line"."id";
SELECT setval('"public"."model_produce_procedure_line_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_product_line_branch_id_seq"
OWNED BY "public"."model_product_line_branch"."id";
SELECT setval('"public"."model_product_line_branch_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_product_line_branch_procedure_id_seq"
OWNED BY "public"."model_product_line_branch_procedure"."id";
SELECT setval('"public"."model_product_line_branch_procedure_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_product_line_branch_procedure_line_id_seq"
OWNED BY "public"."model_product_line_branch_procedure_line"."id";
SELECT setval('"public"."model_product_line_branch_procedure_line_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_product_procedure_dispatch_id_seq"
OWNED BY "public"."model_product_procedure_dispatch"."id";
SELECT setval('"public"."model_product_procedure_dispatch_id_seq"', 2, true);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_product_procedure_line_id_seq"
OWNED BY "public"."model_product_procedure_line"."id";
SELECT setval('"public"."model_product_procedure_line_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_product_type_id_seq"
OWNED BY "public"."model_product_type"."id";
SELECT setval('"public"."model_product_type_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_technology_flow_id_seq"
OWNED BY "public"."model_technology_flow"."id";
SELECT setval('"public"."model_technology_flow_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_technology_flow_type_id_seq"
OWNED BY "public"."model_technology_flow_type"."id";
SELECT setval('"public"."model_technology_flow_type_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_technology_id_seq"
OWNED BY "public"."model_technology"."id";
SELECT setval('"public"."model_technology_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_technology_set_flow_id_seq"
OWNED BY "public"."model_technology_set_flow"."id";
SELECT setval('"public"."model_technology_set_flow_id_seq"', 2, true);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_technology_set_id_seq"
OWNED BY "public"."model_technology_set"."id";
SELECT setval('"public"."model_technology_set_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_technology_set_technology_id_seq"
OWNED BY "public"."model_technology_set_technology"."id";
SELECT setval('"public"."model_technology_set_technology_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_technology_sop_id_seq"
OWNED BY "public"."model_technology_sop"."id";
SELECT setval('"public"."model_technology_sop_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_technology_type_id_seq"
OWNED BY "public"."model_technology_type"."id";
SELECT setval('"public"."model_technology_type_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."model_work_section_id_seq"
OWNED BY "public"."model_work_section"."id";
SELECT setval('"public"."model_work_section_id_seq"', 3, true);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."pm_product_id_seq"
OWNED BY "public"."pm_product"."id";
SELECT setval('"public"."pm_product_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."produce_calendar_id_seq"
OWNED BY "public"."produce_calendar"."id";
SELECT setval('"public"."produce_calendar_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."produce_calendar_type_id_seq"
OWNED BY "public"."produce_calendar_type"."id";
SELECT setval('"public"."produce_calendar_type_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."produce_day_report_detail_id_seq"
OWNED BY "public"."produce_day_report_detail"."id";
SELECT setval('"public"."produce_day_report_detail_id_seq"', 619, true);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."produce_day_report_id_seq"
OWNED BY "public"."produce_day_report"."id";
SELECT setval('"public"."produce_day_report_id_seq"', 26, true);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
SELECT setval('"public"."produce_line_plan_resource_id_seq"', 34, true);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."produce_order_product_plan_id_seq"
OWNED BY "public"."produce_order_product_plan"."id";
SELECT setval('"public"."produce_order_product_plan_id_seq"', 25, true);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."produce_procedure_resource_id_seq"
OWNED BY "public"."produce_procedure_resource"."id";
SELECT setval('"public"."produce_procedure_resource_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."produce_wedf_id_seq"
OWNED BY "public"."produce_wedf"."id";
SELECT setval('"public"."produce_wedf_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."sale_ordermst_id_seq"
OWNED BY "public"."sale_ordermst"."id";
SELECT setval('"public"."sale_ordermst_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."sale_orderproductnodtl_id_seq"
OWNED BY "public"."sale_orderproductnodtl"."id";
SELECT setval('"public"."sale_orderproductnodtl_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."sd_material_require_id_seq"
OWNED BY "public"."sd_material_require"."id";
SELECT setval('"public"."sd_material_require_id_seq"', 154, true);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."ums_admin_id_seq"
OWNED BY "public"."ums_admin"."id";
SELECT setval('"public"."ums_admin_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."ums_admin_permission_relation_id_seq"
OWNED BY "public"."ums_admin_permission_relation"."id";
SELECT setval('"public"."ums_admin_permission_relation_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."ums_admin_role_relation_id_seq"
OWNED BY "public"."ums_admin_role_relation"."id";
SELECT setval('"public"."ums_admin_role_relation_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."ums_menu_id_seq"
OWNED BY "public"."ums_menu"."id";
SELECT setval('"public"."ums_menu_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."ums_permission_id_seq"
OWNED BY "public"."ums_permission"."id";
SELECT setval('"public"."ums_permission_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."ums_resource_category_id_seq"
OWNED BY "public"."ums_resource_category"."id";
SELECT setval('"public"."ums_resource_category_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."ums_resource_id_seq"
OWNED BY "public"."ums_resource"."id";
SELECT setval('"public"."ums_resource_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."ums_role_id_seq"
OWNED BY "public"."ums_role"."id";
SELECT setval('"public"."ums_role_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."ums_role_menu_relation_id_seq"
OWNED BY "public"."ums_role_menu_relation"."id";
SELECT setval('"public"."ums_role_menu_relation_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."ums_role_permission_relation_id_seq"
OWNED BY "public"."ums_role_permission_relation"."id";
SELECT setval('"public"."ums_role_permission_relation_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."ums_role_resource_relation_id_seq"
OWNED BY "public"."ums_role_resource_relation"."id";
SELECT setval('"public"."ums_role_resource_relation_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."wms_box_id_seq"
OWNED BY "public"."wms_box"."id";
SELECT setval('"public"."wms_box_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."wms_box_type_id_seq"
OWNED BY "public"."wms_box_type"."id";
SELECT setval('"public"."wms_box_type_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."wms_stockex_id_seq"
OWNED BY "public"."wms_stockex"."id";
SELECT setval('"public"."wms_stockex_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."wms_stockexmaterial_id_seq"
OWNED BY "public"."wms_stockexmaterial"."id";
SELECT setval('"public"."wms_stockexmaterial_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."wms_store_id_seq"
OWNED BY "public"."wms_store"."id";
SELECT setval('"public"."wms_store_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."wms_warehouse_storage_id_seq"
OWNED BY "public"."wms_warehouse_storage"."id";
SELECT setval('"public"."wms_warehouse_storage_id_seq"', 2, true);

-- ----------------------------
-- Primary Key structure for table hr_dept
-- ----------------------------
ALTER TABLE "public"."hr_dept" ADD CONSTRAINT "hr_dept_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table hr_employee
-- ----------------------------
ALTER TABLE "public"."hr_employee" ADD CONSTRAINT "hr_employee_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table mm_materialcategory
-- ----------------------------
ALTER TABLE "public"."mm_materialcategory" ADD CONSTRAINT "mm_materialcategory_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table mm_materialdtl
-- ----------------------------
ALTER TABLE "public"."mm_materialdtl" ADD CONSTRAINT "mm_materialdtl_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table mm_materialmst
-- ----------------------------
ALTER TABLE "public"."mm_materialmst" ADD CONSTRAINT "mm_materialmst_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table mm_materialsusage
-- ----------------------------
ALTER TABLE "public"."mm_materialsusage" ADD CONSTRAINT "mm_materialsusage_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_action_therbligs
-- ----------------------------
ALTER TABLE "public"."model_action_therbligs" ADD CONSTRAINT "model_action_therbligs_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_action_therbligs_type
-- ----------------------------
ALTER TABLE "public"."model_action_therbligs_type" ADD CONSTRAINT "model_action_therbligs_type_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_actionset
-- ----------------------------
ALTER TABLE "public"."model_actionset" ADD CONSTRAINT "model_actionset_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_basic_action
-- ----------------------------
ALTER TABLE "public"."model_basic_action" ADD CONSTRAINT "model_basic_action_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_basic_action_type
-- ----------------------------
ALTER TABLE "public"."model_basic_action_type" ADD CONSTRAINT "model_basic_action_type_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_device
-- ----------------------------
ALTER TABLE "public"."model_device" ADD CONSTRAINT "model_device_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_device_parameter
-- ----------------------------
ALTER TABLE "public"."model_device_parameter" ADD CONSTRAINT "model_device_parameter_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_device_type
-- ----------------------------
ALTER TABLE "public"."model_device_type" ADD CONSTRAINT "model_device_type_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_procedure
-- ----------------------------
ALTER TABLE "public"."model_procedure" ADD CONSTRAINT "model_procedure_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_procedure_set
-- ----------------------------
ALTER TABLE "public"."model_procedure_set" ADD CONSTRAINT "model_procedure_set_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_procedure_sop
-- ----------------------------
ALTER TABLE "public"."model_procedure_sop" ADD CONSTRAINT "model_procedure_sop_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_procedure_technology
-- ----------------------------
ALTER TABLE "public"."model_procedure_technology" ADD CONSTRAINT "model_procedure_technology_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_produce_action
-- ----------------------------
ALTER TABLE "public"."model_produce_action" ADD CONSTRAINT "model_produce_action_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_produce_action_item
-- ----------------------------
ALTER TABLE "public"."model_produce_action_item" ADD CONSTRAINT "model_produce_action_item_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_produce_line
-- ----------------------------
ALTER TABLE "public"."model_produce_line" ADD CONSTRAINT "model_produce_line_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_produce_line_branch
-- ----------------------------
ALTER TABLE "public"."model_produce_line_branch" ADD CONSTRAINT "model_produce_line_branch_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_produce_line_branch_line
-- ----------------------------
ALTER TABLE "public"."model_produce_line_branch_line" ADD CONSTRAINT "model_produce_line_branch_line_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_produce_line_branch_procedure
-- ----------------------------
ALTER TABLE "public"."model_produce_line_branch_procedure" ADD CONSTRAINT "model_produce_line_branch_procedure_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_produce_line_branch_procedure_line
-- ----------------------------
ALTER TABLE "public"."model_produce_line_branch_procedure_line" ADD CONSTRAINT "model_produce_line_branch_procedure_line_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_produce_procedure_line
-- ----------------------------
ALTER TABLE "public"."model_produce_procedure_line" ADD CONSTRAINT "model_produce_procedure_line_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_product_line_branch
-- ----------------------------
ALTER TABLE "public"."model_product_line_branch" ADD CONSTRAINT "model_product_line_branch_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_product_line_branch_procedure
-- ----------------------------
ALTER TABLE "public"."model_product_line_branch_procedure" ADD CONSTRAINT "model_product_line_branch_procedure_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_product_line_branch_procedure_line
-- ----------------------------
ALTER TABLE "public"."model_product_line_branch_procedure_line" ADD CONSTRAINT "model_product_line_branch_procedure_line_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_product_procedure_dispatch
-- ----------------------------
ALTER TABLE "public"."model_product_procedure_dispatch" ADD CONSTRAINT "model_product_procedure_dispatch_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_product_procedure_line
-- ----------------------------
ALTER TABLE "public"."model_product_procedure_line" ADD CONSTRAINT "model_product_procedure_line_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_product_type
-- ----------------------------
ALTER TABLE "public"."model_product_type" ADD CONSTRAINT "model_product_type_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_technology
-- ----------------------------
ALTER TABLE "public"."model_technology" ADD CONSTRAINT "model_technology_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_technology_flow
-- ----------------------------
ALTER TABLE "public"."model_technology_flow" ADD CONSTRAINT "model_technology_flow_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_technology_flow_type
-- ----------------------------
ALTER TABLE "public"."model_technology_flow_type" ADD CONSTRAINT "model_technology_flow_type_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_technology_set
-- ----------------------------
ALTER TABLE "public"."model_technology_set" ADD CONSTRAINT "model_technology_set_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_technology_set_flow
-- ----------------------------
ALTER TABLE "public"."model_technology_set_flow" ADD CONSTRAINT "model_technology_set_flow_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_technology_set_technology
-- ----------------------------
ALTER TABLE "public"."model_technology_set_technology" ADD CONSTRAINT "model_technology_set_technology_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_technology_sop
-- ----------------------------
ALTER TABLE "public"."model_technology_sop" ADD CONSTRAINT "model_technology_sop_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_technology_type
-- ----------------------------
ALTER TABLE "public"."model_technology_type" ADD CONSTRAINT "model_technology_type_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table model_work_section
-- ----------------------------
ALTER TABLE "public"."model_work_section" ADD CONSTRAINT "model_work_section_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table pm_product
-- ----------------------------
ALTER TABLE "public"."pm_product" ADD CONSTRAINT "pm_product_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table produce_calendar
-- ----------------------------
ALTER TABLE "public"."produce_calendar" ADD CONSTRAINT "produce_calendar_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table produce_calendar_type
-- ----------------------------
ALTER TABLE "public"."produce_calendar_type" ADD CONSTRAINT "produce_calendar_type_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table produce_day_report
-- ----------------------------
ALTER TABLE "public"."produce_day_report" ADD CONSTRAINT "produce_day_report_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table produce_day_report_detail
-- ----------------------------
ALTER TABLE "public"."produce_day_report_detail" ADD CONSTRAINT "produce_day_report_detail_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table produce_line_plan_resource
-- ----------------------------
ALTER TABLE "public"."produce_line_plan_resource" ADD CONSTRAINT "produce_line_plan_resource_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table produce_order_product_plan
-- ----------------------------
ALTER TABLE "public"."produce_order_product_plan" ADD CONSTRAINT "produce_order_product_plan_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table produce_procedure_resource
-- ----------------------------
ALTER TABLE "public"."produce_procedure_resource" ADD CONSTRAINT "produce_procedure_resource_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table produce_wedf
-- ----------------------------
ALTER TABLE "public"."produce_wedf" ADD CONSTRAINT "produce_wedf_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table sale_ordermst
-- ----------------------------
ALTER TABLE "public"."sale_ordermst" ADD CONSTRAINT "sale_ordermst_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table sale_orderproductnodtl
-- ----------------------------
ALTER TABLE "public"."sale_orderproductnodtl" ADD CONSTRAINT "sale_orderproductnodtl_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table sd_material_require
-- ----------------------------
ALTER TABLE "public"."sd_material_require" ADD CONSTRAINT "material_required_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table ums_admin
-- ----------------------------
ALTER TABLE "public"."ums_admin" ADD CONSTRAINT "ums_admin_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table ums_admin_permission_relation
-- ----------------------------
ALTER TABLE "public"."ums_admin_permission_relation" ADD CONSTRAINT "ums_admin_permission_relation_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table ums_admin_role_relation
-- ----------------------------
ALTER TABLE "public"."ums_admin_role_relation" ADD CONSTRAINT "ums_admin_role_relation_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table ums_menu
-- ----------------------------
ALTER TABLE "public"."ums_menu" ADD CONSTRAINT "ums_menu_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table ums_permission
-- ----------------------------
ALTER TABLE "public"."ums_permission" ADD CONSTRAINT "ums_permission_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table ums_resource
-- ----------------------------
ALTER TABLE "public"."ums_resource" ADD CONSTRAINT "ums_resource_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table ums_resource_category
-- ----------------------------
ALTER TABLE "public"."ums_resource_category" ADD CONSTRAINT "ums_resource_category_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table ums_role
-- ----------------------------
ALTER TABLE "public"."ums_role" ADD CONSTRAINT "ums_role_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table ums_role_menu_relation
-- ----------------------------
ALTER TABLE "public"."ums_role_menu_relation" ADD CONSTRAINT "ums_role_menu_relation_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table ums_role_permission_relation
-- ----------------------------
ALTER TABLE "public"."ums_role_permission_relation" ADD CONSTRAINT "ums_role_permission_relation_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table ums_role_resource_relation
-- ----------------------------
ALTER TABLE "public"."ums_role_resource_relation" ADD CONSTRAINT "ums_role_resource_relation_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table wms_box
-- ----------------------------
ALTER TABLE "public"."wms_box" ADD CONSTRAINT "wms_box_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table wms_box_type
-- ----------------------------
ALTER TABLE "public"."wms_box_type" ADD CONSTRAINT "wms_box_type_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table wms_stockex
-- ----------------------------
ALTER TABLE "public"."wms_stockex" ADD CONSTRAINT "wms_stockex_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table wms_stockexmaterial
-- ----------------------------
ALTER TABLE "public"."wms_stockexmaterial" ADD CONSTRAINT "wms_stockexmaterial_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table wms_store
-- ----------------------------
ALTER TABLE "public"."wms_store" ADD CONSTRAINT "wms_store_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table wms_warehouse_storage
-- ----------------------------
ALTER TABLE "public"."wms_warehouse_storage" ADD CONSTRAINT "wms_warehouse_storage_pkey" PRIMARY KEY ("id");
